ByteScout Barcode Suite - C++ - Create simple spreasdsheet with spreadsheet sdk - ByteScout

ByteScout Barcode Suite – C++ – Create simple spreasdsheet with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – C++ – Create simple spreasdsheet with spreadsheet sdk

How to create simple spreasdsheet with spreadsheet sdk in C++ and ByteScout Barcode Suite

If you want to learn more then this tutorial will show how to create simple spreasdsheet with spreadsheet sdk in C++

These source code samples are assembled by their programming language and functions they apply. ByteScout Barcode Suite: the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can create simple spreasdsheet with spreadsheet sdk in C++.

Want to save time? You will save a lot of time on writing and testing code as you may just take the C++ code from ByteScout Barcode Suite for create simple spreasdsheet with spreadsheet sdk below and use it in your application. Just copy and paste the code into your C++ application’s code and follow the instructions. If you want to use these C++ sample examples in one or many applications then they can be used easily.

You can download free trial version of ByteScout Barcode Suite from our website to see and try many others source code samples for C++.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

HelloWorld.cpp
      
// IMPORTANT: Copy ByteScout.Spreadsheet.tlb into the project folder // HelloWorld.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #pragma warning (disable: 4278) #import "c:\windows\system32\stdole2.tlb" rename_namespace("BytescoutSpreadsheet") exclude("GUID", "DISPPARAMS", "EXCEPINFO", \ "OLE_XPOS_PIXELS", "OLE_YPOS_PIXELS", "OLE_XSIZE_PIXELS", "OLE_YSIZE_PIXELS", "OLE_XPOS_HIMETRIC", \ "OLE_YPOS_HIMETRIC", "OLE_XSIZE_HIMETRIC", "OLE_YSIZE_HIMETRIC", "OLE_XPOS_CONTAINER", \ "OLE_YPOS_CONTAINER", "OLE_XSIZE_CONTAINER", "OLE_YSIZE_CONTAINER", "OLE_HANDLE", "OLE_OPTEXCLUSIVE", \ "OLE_CANCELBOOL", "OLE_ENABLEDEFAULTBOOL", "FONTSIZE", "OLE_COLOR") // To use managed-code servers like the C# server, // we have to import the common language runtime: #import <mscorlib.tlb> raw_interfaces_only #import <System.tlb> raw_interfaces_only #import <System.Drawing.tlb> raw_interfaces_only #import "Bytescout.Spreadsheet.tlb" rename_namespace("BytescoutSpreadsheet") //no_namespace named_guids int main(int argc, char* argv[]) { // initialize OLE HRESULT hr = CoInitialize(NULL); // check for errors if (FAILED(hr)) { MessageBox(0,"OLE initialization errp","error",MB_OK); return -1; } // declare document object ISpreadsheet * Doc = NULL; CLSID clsid; _Worksheets* worksheets = NULL; _Worksheet* worksheet = NULL; _Cell* cell = NULL; // get inuque ID for ISpreadsheet interface hr = CLSIDFromProgID(OLESTR("Bytescout.Spreadsheet.Spreadsheet"), &clsid); // check for errors if (FAILED(hr)) { MessageBox(0,"Can't get CLSID for ISpreadsheet interface","error",MB_OK); goto Uninit; }; // create Spreadsheet object hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(ISpreadsheet), (LPVOID*)&Doc); // check for errors if (FAILED(hr)) { MessageBox(0,"Can't create Spreadsheet object","error",MB_OK); goto Uninit; } //IWorksheets* worksheets = NULL; Doc->get_Worksheets(&worksheets); worksheet = reinterpret_cast<IWorksheets*>(worksheets)->Add("Sheet 1"); cell = reinterpret_cast<IWorksheet*>(worksheet)->Cell("A1"); reinterpret_cast<ICell*>(cell)->PutValueAsHTML("test value"); Doc->SaveAs("output.xls"); // release PDFDoc object Doc->Release(); // uninitialize OLE libraries Uninit: CoUninitialize(); return 0; }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

StdAfx.cpp
      
// stdafx.cpp : source file that includes just the standard includes // HelloWorld.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

StdAfx.h
      
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__59C6B829_CE1C_476C_B7F7_AADB9A4AC838__INCLUDED_) #define AFX_STDAFX_H__59C6B829_CE1C_476C_B7F7_AADB9A4AC838__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <stdio.h> // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__59C6B829_CE1C_476C_B7F7_AADB9A4AC838__INCLUDED_)

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next