Last active
June 24, 2025 03:38
-
-
Save aspose-cells-gists/6f7d9819d85793c3a3b5d040af42e1a9 to your computer and use it in GitHub Desktop.
Aspose.Cells for C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.xlsx"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.ods"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.ods"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.xls"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.xls"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.xlsb"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.xlsb"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.xlsm"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.xlsm"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir = u"SourceDirectory\\Excel\\"; | |
// Output directory path. | |
U16String outDir = u"OutputDirectory\\"; | |
// Load the source ODS Excel file | |
Workbook wkb(srcDir + u"SampleFile.xlsx"); | |
// Retrieve the first worksheet | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Add comment to the cell F5 | |
int commentIndex = wks.GetComments().Add(u"F5"); | |
// Retrieve the comment added to the cell F5 | |
Comment cmt = wks.GetComments().Get(commentIndex); | |
// Set the comment note | |
cmt.SetNote(u"Hello Aspose!"); | |
// Save the Excel file | |
wkb.Save(outDir + u"AddComment_out.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath =u"..\\Data\\LoadingSavingAndConverting\\"; | |
//Output directory path | |
U16String outPath = u"..\\Data\\Output\\"; | |
//Paths of source and output excel files | |
U16String samplePath = dirPath + u"sample-metadata-properties.xlsx"; | |
U16String outputPath = outPath + u"output-metadata-properties.xlsx"; | |
//method 1 | |
//Load the sample excel file | |
Workbook wb(samplePath); | |
//Add a new custom property | |
U16String strCustomPropName = u"MyCustom5"; | |
U16String strCustomPropValue = u"This is my custom five."; | |
wb.GetCustomDocumentProperties().Add(strCustomPropName, strCustomPropValue); | |
//Save the output excel file | |
wb.Save(outputPath); | |
////method 2 | |
////Load the sample excel file | |
//Metadata::MetadataOptions options(Metadata::MetadataType::Document_Properties); | |
//Metadata::WorkbookMetadata meta(samplePath, options); | |
////Add a new custom property | |
//meta.GetCustomDocumentProperties().Add(strCustomPropName, strCustomPropValue); | |
////Save the output excel file | |
//meta.Save(outputPath); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
U16String dataDir = u""; | |
Aspose::Cells::Startup(); | |
// Instantiate a new workbook | |
Workbook workbook; | |
// Get the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Insert a string value to a cell | |
worksheet.GetCells().Get(u"C2").PutValue(u"Image Hyperlink"); | |
// Set the 4th row height | |
worksheet.GetCells().SetRowHeight(3, 100); | |
// Set the C column width | |
worksheet.GetCells().SetColumnWidth(2, 21); | |
// Add a picture to the C4 cell | |
int index = worksheet.GetPictures().Add(3, 2, 4, 3, dataDir + u"aspose-log.png"); | |
// Get the picture object | |
Picture pic = worksheet.GetPictures().Get(index); | |
// Set the placement type | |
pic.SetPlacement(PlacementType::FreeFloating); | |
// Add an image hyperlink | |
Hyperlink hlink = pic.AddHyperlink(u"http://www.aspose.com/"); | |
// Specify the screen tip | |
hlink.SetScreenTip(u"Click to go to Aspose site"); | |
// Save the Excel file | |
workbook.Save(dataDir + u"out.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Gist contains code example snippets for Aspose.Cells for C++. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Path of output excel file | |
U16String outputData = resultPath + u"outputData.xlsx"; | |
//create a new workbook | |
Workbook workbook; | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
Cells cells = worksheet.GetCells(); | |
//Adding a string value to the cell | |
worksheet.GetCells().Get("A1").PutValue(u"Hello World!"); | |
//Adding a double value to the cell | |
cells.Get("A2").PutValue(20.5); | |
//Adding an integer value to the cell | |
cells.Get("A3").PutValue(15); | |
//Adding a boolean value to the cell | |
cells.Get("A4").PutValue(true); | |
//Setting the display format of the date | |
Cell cell = cells.Get("A5"); | |
cell.PutValue(45379); | |
Style style = cell.GetStyle(); | |
style.SetNumber(15); | |
cell.SetStyle(style); | |
//Save the workbook | |
workbook.Save(outputData); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a new workbook | |
Workbook wb; | |
//Get first worksheet which is created by default | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Adding a value to "A1" cell | |
Cell cell = ws.GetCells().Get("A1"); | |
cell.PutValue(5); | |
//Adding a value to "A2" cell | |
cell = ws.GetCells().Get("A2");; | |
cell.PutValue(15); | |
//Adding a value to "A3" cell | |
cell = ws.GetCells().Get("A3");; | |
cell.PutValue(25); | |
//Adding SUM formula to "A4" cell | |
cell = ws.GetCells().Get("A4");; | |
cell.SetFormula(u"=SUM(A1:A3)"); | |
//Calculating the results of formulas | |
wb.CalculateFormula(); | |
//Get the calculated value of the cell "A4" and print it on console | |
cell = ws.GetCells().Get("A4");; | |
std::cout << "Calculated Value of Cell A4: " << cell.GetStringValue().ToUtf8() << endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\Excel\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Load the input Excel file | |
Workbook workbook(srcDir + u"Sample1.xlsx"); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Copy Row | |
worksheet.GetCells().CopyColumn(worksheet.GetCells(), 0, 6); | |
// Save the Excel file | |
workbook.Save(outDir + u"CopyColumn_out.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\Excel\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Load the input Excel file | |
Workbook workbook(srcDir + u"Sample1.xlsx"); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Copy Row | |
worksheet.GetCells().CopyColumns(worksheet.GetCells(), 0, 6, 3); | |
// Save the Excel file | |
workbook.Save(outDir + u"CopyColumns_out.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\Excel\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Load the input Excel file | |
Workbook workbook(srcDir + u"Sample1.xlsx"); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Copy Row | |
worksheet.GetCells().CopyRow(worksheet.GetCells(), 1, 15); | |
// Save the Excel file | |
workbook.Save(outDir + u"CopyRow_out.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\Excel\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Load the input Excel file | |
Workbook workbook(srcDir + u"Sample1.xlsx"); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Copy Row | |
worksheet.GetCells().CopyRows(worksheet.GetCells(), 1, 15, 3); | |
// Save the Excel file | |
workbook.Save(outDir + u"CopyRows_out.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Path of output excel file | |
U16String outputChartTypePyramid = resultPath + u"Exce_Pyramid_Chart.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get("A1").PutValue(50); | |
worksheet.GetCells().Get("A2").PutValue(100); | |
worksheet.GetCells().Get("A3").PutValue(150); | |
worksheet.GetCells().Get("B1").PutValue(4); | |
worksheet.GetCells().Get("B2").PutValue(20); | |
worksheet.GetCells().Get("B3").PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(ChartType::Pyramid, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart.GetNSeries().Add(u"A1:B3", true); | |
// Saving the Excel file | |
workbook.Save(outputChartTypePyramid); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*create a new workbook*/ | |
Workbook wb; | |
/*get the first worksheet*/ | |
WorksheetCollection wsc = wb.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
/*get cell(0,0)*/ | |
Cells cells = ws.GetCells(); | |
Cell cell = cells.Get(0, 0); | |
/*write "Hello World" to cell(0,0) of the first sheet*/ | |
cell.PutValue(u"Hello World!"); | |
/*save this workbook to resultFile folder*/ | |
wb.Save(resultPath + u"outputData.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Path of output excel file | |
U16String outputData = resultPath + u"workbook.xlsx"; | |
//create a new workbook | |
Workbook wb; | |
//get the first worksheet | |
WorksheetCollection wsc = wb.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
//get cell(0,0) | |
Cells cells = ws.GetCells(); | |
Cell cell = cells.Get(0, 0); | |
//write "Hello World" to cell(0,0) of the first sheet | |
cell.PutValue(u"Hello World!"); | |
//save this workbook to resultFile folder | |
wb.Save(outputData); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Create an instance of the Workbook class | |
Workbook workbook; | |
// Access the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Add source data for pivot table | |
worksheet.GetCells().Get(u"A1").PutValue(u"Fruit"); | |
worksheet.GetCells().Get(u"B1").PutValue(u"Quantity"); | |
worksheet.GetCells().Get(u"C1").PutValue(u"Price"); | |
worksheet.GetCells().Get(u"A2").PutValue(u"Apple"); | |
worksheet.GetCells().Get(u"A3").PutValue(u"Orange"); | |
worksheet.GetCells().Get(u"A4").PutValue(u"Mango"); | |
worksheet.GetCells().Get(u"B2").PutValue(3); | |
worksheet.GetCells().Get(u"B3").PutValue(4); | |
worksheet.GetCells().Get(u"B4").PutValue(4); | |
worksheet.GetCells().Get(u"C2").PutValue(2); | |
worksheet.GetCells().Get(u"C3").PutValue(1); | |
worksheet.GetCells().Get(u"C4").PutValue(4); | |
// Add pivot table | |
int idx = worksheet.GetPivotTables().Add(u"A1:C4", u"E5", u"MyPivotTable"); | |
// Access created pivot table | |
PivotTable pivotTable = worksheet.GetPivotTables().Get(idx); | |
// Manipulate pivot table rows, columns and data fields | |
pivotTable.AddFieldToArea(PivotFieldType::Row, pivotTable.GetBaseFields().Get(0)); | |
pivotTable.AddFieldToArea(PivotFieldType::Data, pivotTable.GetBaseFields().Get(1)); | |
pivotTable.AddFieldToArea(PivotFieldType::Data, pivotTable.GetBaseFields().Get(2)); | |
pivotTable.AddFieldToArea(PivotFieldType::Column, pivotTable.GetDataField()); | |
// Set the pivot table style | |
pivotTable.SetPivotTableStyleType(PivotTableStyleType::PivotTableStyleMedium9); | |
// Save the output excel file | |
workbook.Save(outDir + u"outputCreatePivotTable.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instantiate a Workbook object | |
Workbook workbook; | |
// Obtaining the reference of the default(first) worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Obtaining Worksheet's cells collection | |
Cells cells = worksheet.GetCells(); | |
// Setting the value to the cells | |
cells.Get("A1").PutValue(u"Employee"); | |
cells.Get("B1").PutValue(u"Quarter"); | |
cells.Get("C1").PutValue(u"Product"); | |
cells.Get("D1").PutValue(u"Continent"); | |
cells.Get("E1").PutValue(u"Country"); | |
cells.Get("F1").PutValue(u"Sale"); | |
cells.Get("A2").PutValue(u"David"); | |
cells.Get("A3").PutValue(u"David"); | |
cells.Get("A4").PutValue(u"David"); | |
cells.Get("A5").PutValue(u"David"); | |
cells.Get("A6").PutValue(u"James"); | |
cells.Get("B2").PutValue(1); | |
cells.Get("B3").PutValue(2); | |
cells.Get("B4").PutValue(3); | |
cells.Get("B5").PutValue(4); | |
cells.Get("B6").PutValue(1); | |
cells.Get("C2").PutValue(u"Maxilaku"); | |
cells.Get("C3").PutValue(u"Maxilaku"); | |
cells.Get("C4").PutValue(u"Chai"); | |
cells.Get("C5").PutValue(u"Maxilaku"); | |
cells.Get("C6").PutValue(u"Chang"); | |
cells.Get("D2").PutValue(u"Asia"); | |
cells.Get("D3").PutValue(u"Asia"); | |
cells.Get("D4").PutValue(u"Asia"); | |
cells.Get("D5").PutValue(u"Asia"); | |
cells.Get("D6").PutValue(u"Europe"); | |
cells.Get("E2").PutValue(u"China"); | |
cells.Get("E3").PutValue(u"India"); | |
cells.Get("E4").PutValue(u"Korea"); | |
cells.Get("E5").PutValue(u"India"); | |
cells.Get("E6").PutValue(u"France"); | |
cells.Get("F2").PutValue(2000); | |
cells.Get("F3").PutValue(500); | |
cells.Get("F4").PutValue(1200); | |
cells.Get("F5").PutValue(1500); | |
cells.Get("F6").PutValue(500); | |
// Adding a new List Object to the worksheet | |
worksheet.GetListObjects().Add(u"A1", u"F6", true); | |
ListObject listObject = worksheet.GetListObjects().Get(0); | |
// Adding Default Style to the table | |
listObject.SetTableStyleType(TableStyleType::TableStyleMedium10); | |
// Show Total | |
listObject.SetShowTotals(true); | |
// Saving the Excel file | |
workbook.Save(resultPath + u"Excel_Table.xlsx"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Path of the input excel file | |
U16String samplePivotTable = srcDir + u"SamplePivotTable.xlsx"; | |
// Path of the output excel file | |
U16String outputHiddenRowPivotTable = outDir + u"outputHiddenRowPivotTable.xlsx"; | |
// Load the sample excel file | |
Workbook workbook(samplePivotTable); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access the pivot table | |
PivotTable pivotTable = worksheet.GetPivotTables().Get(0); | |
// Get pivot table body range | |
CellArea dataBodyRange = pivotTable.GetDataBodyRange(); | |
// Pivot table starting row | |
int currentRow = 5; | |
// Pivot table ending row | |
int rowsUsed = dataBodyRange.EndRow; | |
// Iterate through the rows, compare the cell value and hide the rows. | |
for (int i = currentRow; i < rowsUsed; i++) | |
{ | |
Cell cell = worksheet.GetCells().GetCell(i, 4); | |
if (cell.GetStringValue() == "Orange") | |
{ | |
worksheet.GetCells().HideRow(i); | |
} | |
} | |
// Refresh and calculate the data in the pivot table. | |
pivotTable.RefreshData(); | |
pivotTable.CalculateData(); | |
// Save the output excel file | |
workbook.Save(outputHiddenRowPivotTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Path of the input excel file | |
U16String samplePivotTable = srcDir + u"SamplePivotTable.xlsx"; | |
// Path of the output excel file | |
U16String outputManipulatePivotTable = outDir + u"outputManipulatePivotTable.xlsx"; | |
// Load the sample excel file | |
Workbook workbook(samplePivotTable); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Change value of cell A2 which is inside the source data of pivot table | |
U16String str("Orange"); | |
worksheet.GetCells().Get("A2").PutValue(str); | |
// Access pivot table, refresh and calculate it | |
PivotTable pivotTable = worksheet.GetPivotTables().Get(0); | |
pivotTable.RefreshData(); | |
pivotTable.CalculateData(); | |
// Save the output excel file | |
workbook.Save(outputManipulatePivotTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source directory path. | |
U16String srcDir("SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir("OutputDirectory\\"); | |
// Path of the input excel file | |
U16String samplePivotTable = srcDir + u"SamplePivotTable.xlsx"; | |
// Path of the output excel file | |
U16String outputSortedPivotTable = outDir + u"outputSortedPivotTable.xlsx"; | |
// Load the sample excel file | |
Workbook workbook(samplePivotTable); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access the pivot table | |
PivotTable pivotTable = worksheet.GetPivotTables().Get(0); | |
// Set pivot table sorting | |
pivotTable.AddFieldToArea(PivotFieldType::Row, 0); | |
PivotField pivotField = pivotTable.GetRowFields().Get(0); | |
pivotField.SetIsAutoSort(true); | |
pivotField.SetIsAscendSort(false); | |
// Refresh and calculate the data in the pivot table. | |
pivotTable.RefreshData(); | |
pivotTable.CalculateData(); | |
// Save the output excel file | |
workbook.Save(outputSortedPivotTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
U16String outputChartTypeBubble = outDir + u"outputChartTypeBubble.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Fill in data for chart's series | |
// Y Values | |
worksheet.GetCells().Get(0, 0).PutValue(u"Y Values"); | |
worksheet.GetCells().Get(0, 1).PutValue(2); | |
worksheet.GetCells().Get(0, 2).PutValue(4); | |
worksheet.GetCells().Get(0, 3).PutValue(6); | |
// Bubble Size | |
worksheet.GetCells().Get(1, 0).PutValue(u"Bubble Size"); | |
worksheet.GetCells().Get(1, 1).PutValue(2); | |
worksheet.GetCells().Get(1, 2).PutValue(3); | |
worksheet.GetCells().Get(1, 3).PutValue(1); | |
// X Values | |
worksheet.GetCells().Get(2, 0).PutValue(u"X Values"); | |
worksheet.GetCells().Get(2, 1).PutValue(1); | |
worksheet.GetCells().Get(2, 2).PutValue(2); | |
worksheet.GetCells().Get(2, 3).PutValue(3); | |
// Set first column width | |
worksheet.GetCells().SetColumnWidth(0, 12); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Bubble, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from B1 to D1 | |
chart.GetNSeries().Add(u"B1:D1", true); | |
// Set bubble sizes | |
chart.GetNSeries().Get(0).SetBubbleSizes(u"B2:D2"); | |
// Set X axis values | |
chart.GetNSeries().Get(0).SetXValues(u"B3:D3"); | |
// Set Y axis values | |
chart.GetNSeries().Get(0).SetValues(u"B1:D1"); | |
// Saving the Excel file | |
workbook.Save(outputChartTypeBubble); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
StringPtr outputChartTypeBubble = outDir->StringAppend(new String("outputChartTypeBubble.xlsx")); | |
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Fill in data for chart's series | |
// Y Values | |
worksheet->GetICells()->GetObjectByIndex(0, 0)->PutValue((StringPtr)new String("Y Values")); | |
worksheet->GetICells()->GetObjectByIndex(0, 1)->PutValue(2); | |
worksheet->GetICells()->GetObjectByIndex(0, 2)->PutValue(4); | |
worksheet->GetICells()->GetObjectByIndex(0, 3)->PutValue(6); | |
// Bubble Size | |
worksheet->GetICells()->GetObjectByIndex(1, 0)->PutValue((StringPtr)new String("Bubble Size")); | |
worksheet->GetICells()->GetObjectByIndex(1, 1)->PutValue(2); | |
worksheet->GetICells()->GetObjectByIndex(1, 2)->PutValue(3); | |
worksheet->GetICells()->GetObjectByIndex(1, 3)->PutValue(1); | |
// X Values | |
worksheet->GetICells()->GetObjectByIndex(2, 0)->PutValue((StringPtr)new String("X Values")); | |
worksheet->GetICells()->GetObjectByIndex(2, 1)->PutValue(1); | |
worksheet->GetICells()->GetObjectByIndex(2, 2)->PutValue(2); | |
worksheet->GetICells()->GetObjectByIndex(2, 3)->PutValue(3); | |
// Set first column width | |
worksheet->GetICells()->SetColumnWidth(0, 12); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet->GetICharts()->Add(Aspose::Cells::Charts::ChartType::ChartType_Bubble, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
intrusive_ptr<Aspose::Cells::Charts::IChart> chart = worksheet->GetICharts()->GetObjectByIndex(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from B1 to D1 | |
chart->GetNISeries()->Add(new String("B1:D1"), true); | |
// Set bubble sizes | |
chart->GetNISeries()->GetObjectByIndex(0)->SetBubbleSizes(new String("B2:D2")); | |
// Set X axis values | |
chart->GetNISeries()->GetObjectByIndex(0)->SetXValues(new String("B3:D3")); | |
// Set Y axis values | |
chart->GetNISeries()->GetObjectByIndex(0)->SetValues(new String("B1:D1")); | |
// Saving the Excel file | |
workbook->Save(outputChartTypeBubble); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
U16String outputChartTypeCustom = outDir + u"outputChartTypeCustom.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the Excel file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
StringPtr outputChartTypeCustom = outDir->StringAppend(new String("outputChartTypeCustom.xlsx")); | |
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding sample values to cells | |
worksheet->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(50); | |
worksheet->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(100); | |
worksheet->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(150); | |
worksheet->GetICells()->GetObjectByIndex(new String("A4"))->PutValue(110); | |
worksheet->GetICells()->GetObjectByIndex(new String("B1"))->PutValue(260); | |
worksheet->GetICells()->GetObjectByIndex(new String("B2"))->PutValue(12); | |
worksheet->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(50); | |
worksheet->GetICells()->GetObjectByIndex(new String("B4"))->PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet->GetICharts()->Add(Aspose::Cells::Charts::ChartType::ChartType_Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
intrusive_ptr<Aspose::Cells::Charts::IChart> chart = worksheet->GetICharts()->GetObjectByIndex(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart->GetNISeries()->Add(new String("A1:B4"), true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart->GetNISeries()->GetObjectByIndex(1)->SetType(Aspose::Cells::Charts::ChartType::ChartType_Line); | |
// Saving the Excel file | |
workbook->Save(outputChartTypeCustom); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
U16String outputChartTypeLine = testPath + u"outputChartTypeLine.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"B1").PutValue(4); | |
worksheet.GetCells().Get(u"B2").PutValue(20); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Line, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart.GetNSeries().Add(u"A1:B3", true); | |
// Saving the Excel file | |
workbook.Save(outputChartTypeLine); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
StringPtr outputChartTypeLine = outDir->StringAppend(new String("outputChartTypeLine.xlsx")); | |
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding sample values to cells | |
worksheet->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(50); | |
worksheet->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(100); | |
worksheet->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(150); | |
worksheet->GetICells()->GetObjectByIndex(new String("B1"))->PutValue(4); | |
worksheet->GetICells()->GetObjectByIndex(new String("B2"))->PutValue(20); | |
worksheet->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet->GetICharts()->Add(Aspose::Cells::Charts::ChartType::ChartType_Line, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
intrusive_ptr<Aspose::Cells::Charts::IChart> chart = worksheet->GetICharts()->GetObjectByIndex(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart->GetNISeries()->Add(new String("A1:B3"), true); | |
// Saving the Excel file | |
workbook->Save(outputChartTypeLine); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
U16String outputChartTypePyramid = outDir + u"outputChartTypePyramid.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"B1").PutValue(4); | |
worksheet.GetCells().Get(u"B2").PutValue(20); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Pyramid, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart.GetNSeries().Add(u"A1:B3", true); | |
// Saving the Excel file | |
workbook.Save(outputChartTypePyramid); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output excel file | |
StringPtr outputChartTypePyramid = outDir->StringAppend(new String("outputChartTypePyramid.xlsx")); | |
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding sample values to cells | |
worksheet->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(50); | |
worksheet->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(100); | |
worksheet->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(150); | |
worksheet->GetICells()->GetObjectByIndex(new String("B1"))->PutValue(4); | |
worksheet->GetICells()->GetObjectByIndex(new String("B2"))->PutValue(20); | |
worksheet->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet->GetICharts()->Add(Aspose::Cells::Charts::ChartType::ChartType_Pyramid, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
intrusive_ptr<Aspose::Cells::Charts::IChart> chart = worksheet->GetICharts()->GetObjectByIndex(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart->GetNISeries()->Add(new String("A1:B3"), true); | |
// Saving the Excel file | |
workbook->Save(outputChartTypePyramid); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleReadAndManipulateExcel2016Charts = srcDir + u"sampleReadAndManipulateExcel2016Charts.xlsx"; | |
//Path of output excel file | |
U16String outputReadAndManipulateExcel2016Charts = outDir + u"outputReadAndManipulateExcel2016Charts.xlsx"; | |
// Load sample Excel file containing Excel 2016 charts | |
Workbook workbook(sampleReadAndManipulateExcel2016Charts); | |
// Access the first worksheet which contains the charts | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access all charts one by one and read their types | |
for (int i = 0; i < worksheet.GetCharts().GetCount(); i++) | |
{ | |
// Access the chart | |
Chart ch = worksheet.GetCharts().Get(i); | |
//Get the chart type | |
ChartType chartType = ch.GetType(); | |
//Convert chart type enum to string | |
U16String strChartType = u""; | |
switch (chartType) | |
{ | |
case Aspose::Cells::Charts::ChartType::BoxWhisker: | |
strChartType = u"BoxWhisker"; | |
break; | |
case Aspose::Cells::Charts::ChartType::Histogram: | |
strChartType = u"Histogram"; | |
break; | |
case Aspose::Cells::Charts::ChartType::Sunburst: | |
strChartType = u"Sunburst"; | |
break; | |
case Aspose::Cells::Charts::ChartType::Treemap: | |
strChartType = u"Treemap"; | |
break; | |
case Aspose::Cells::Charts::ChartType::Waterfall: | |
strChartType = u"Waterfall"; | |
break; | |
default: | |
break; | |
} | |
// Print chart type | |
std::cout << strChartType.ToUtf8() << std::endl; | |
// Change the title of the charts as per their types | |
U16String strTitle = u"Chart Type is " + strChartType; | |
ch.GetTitle().SetText(strTitle); | |
} | |
// Save the workbook | |
workbook.Save(outputReadAndManipulateExcel2016Charts); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleReadAndManipulateExcel2016Charts = srcDir->StringAppend(new String("sampleReadAndManipulateExcel2016Charts.xlsx")); | |
//Path of output excel file | |
StringPtr outputReadAndManipulateExcel2016Charts = outDir->StringAppend(new String("outputReadAndManipulateExcel2016Charts.xlsx")); | |
// Load sample Excel file containing Excel 2016 charts | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleReadAndManipulateExcel2016Charts); | |
// Access the first worksheet which contains the charts | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Access all charts one by one and read their types | |
for (int i = 0; i < worksheet->GetICharts()->GetCount(); i++) | |
{ | |
// Access the chart | |
intrusive_ptr<IChart> ch = worksheet->GetICharts()->GetObjectByIndex(i); | |
//Get the chart type | |
ChartType chartType = ch->GetType(); | |
//Convert chart type enum to string | |
StringPtr strChartType = NULL; | |
switch (chartType) | |
{ | |
case Aspose::Cells::Charts::ChartType_BoxWhisker: | |
strChartType = new String("BoxWhisker"); | |
break; | |
case Aspose::Cells::Charts::ChartType_Histogram: | |
strChartType = new String("Histogram"); | |
break; | |
case Aspose::Cells::Charts::ChartType_Sunburst: | |
strChartType = new String("Sunburst"); | |
break; | |
case Aspose::Cells::Charts::ChartType_Treemap: | |
strChartType = new String("Treemap"); | |
break; | |
case Aspose::Cells::Charts::ChartType_Waterfall: | |
strChartType = new String("Waterfall"); | |
break; | |
default: | |
break; | |
} | |
// Print chart type | |
Aspose::Cells::Systems::Console::WriteLine(strChartType); | |
// Change the title of the charts as per their types | |
StringPtr strTitle = (StringPtr)(new String("Chart Type is "))->Append(strChartType); | |
ch->GetITitle()->SetText(strTitle); | |
} | |
// Save the workbook | |
workbook->Save(outputReadAndManipulateExcel2016Charts); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\OutputDirectory\\"; | |
// Path of output image file | |
U16String outputChartImage = outDir + u"out1image.png"; | |
// Create a new workbook | |
Workbook wkb; | |
// Get first worksheet which is created by default | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
wks.GetCells().Get(u"A1").PutValue(50); | |
wks.GetCells().Get(u"A2").PutValue(100); | |
wks.GetCells().Get(u"A3").PutValue(150); | |
wks.GetCells().Get(u"B1").PutValue(4); | |
wks.GetCells().Get(u"B2").PutValue(20); | |
wks.GetCells().Get(u"B3").PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = wks.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = wks.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart.GetNSeries().Add(u"A1:B3", true); | |
// Saving the chart to image file | |
chart.ToImage(outputChartImage, ImageType::Png); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Path of output XLSM file | |
U16String outputChartTypeCustom = u"sourceFile.xlsm"; | |
// Create a new workbook | |
Workbook wkb; | |
// Get first worksheet which is created by default | |
Worksheet wks = wkb.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
wks.GetCells().Get(u"A1").PutValue(50); | |
wks.GetCells().Get(u"A2").PutValue(100); | |
wks.GetCells().Get(u"A3").PutValue(150); | |
wks.GetCells().Get(u"B1").PutValue(4); | |
wks.GetCells().Get(u"B2").PutValue(20); | |
wks.GetCells().Get(u"B3").PutValue(50); | |
// Adding a chart to the worksheet | |
int chartIndex = wks.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = wks.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from "A1" cell to "B3" | |
chart.GetNSeries().Add(u"A1:B3", true); | |
// Saving the ODS file | |
wkb.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\outputDirectory\\"; | |
// Path of output ODS file | |
U16String outputChartTypeCustom = outDir + u"sourceFile.ods"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the ODS file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\outputDirectory\\"; | |
// Path of output XLS file | |
U16String outputChartTypeCustom = outDir + u"sourceFile.xls"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the XLS file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\outputDirectory\\"; | |
// Path of output XLSB file | |
U16String outputChartTypeCustom = outDir + u"sourceFile.xlsb"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the XLSB file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\outputDirectory\\"; | |
// Path of output XLSM file | |
U16String outputChartTypeCustom = outDir + u"sourceFile.xlsm"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the XLSM file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Output directory path | |
U16String outDir = u"..\\outputDirectory\\"; | |
// Path of output XLSX file | |
U16String outputChartTypeCustom = outDir + u"sourceFile.xlsx"; | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding sample values to cells | |
worksheet.GetCells().Get(u"A1").PutValue(50); | |
worksheet.GetCells().Get(u"A2").PutValue(100); | |
worksheet.GetCells().Get(u"A3").PutValue(150); | |
worksheet.GetCells().Get(u"A4").PutValue(110); | |
worksheet.GetCells().Get(u"B1").PutValue(260); | |
worksheet.GetCells().Get(u"B2").PutValue(12); | |
worksheet.GetCells().Get(u"B3").PutValue(50); | |
worksheet.GetCells().Get(u"B4").PutValue(100); | |
// Adding a chart to the worksheet | |
int chartIndex = worksheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 5, 0, 20, 8); | |
// Accessing the instance of the newly added chart | |
Chart chart = worksheet.GetCharts().Get(chartIndex); | |
// Adding SeriesCollection (chart data source) to the chart ranging from A1 to B4 | |
chart.GetNSeries().Add(u"A1:B4", true); | |
// Setting the chart type of 2nd NSeries to display as line chart | |
chart.GetNSeries().Get(1).SetType(Aspose::Cells::Charts::ChartType::Line); | |
// Saving the XLSX file | |
workbook.Save(outputChartTypeCustom); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleExtractingOLEObjectsFromWorksheet = srcDir + u"sampleExtractingOLEObjectsFromWorksheet.xlsx"; | |
// Load sample Excel file containing OLE objects. | |
Workbook workbook(sampleExtractingOLEObjectsFromWorksheet); | |
// Get the first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access the count of Ole objects. | |
int oleCount = worksheet.GetOleObjects().GetCount(); | |
// Iterate all the Ole objects and save to disk with correct file format extension. | |
for (int i = 0; i < oleCount; i++) | |
{ | |
// Access Ole object. | |
OleObject oleObj = worksheet.GetOleObjects().Get(i); | |
// Access the Ole ProgID. | |
U16String strProgId = oleObj.GetProgID(); | |
// Find the correct file extension. | |
U16String fileExt = u""; | |
if (strProgId == u"Document") | |
{ | |
fileExt = u".docx"; | |
} | |
else if (strProgId ==u"Presentation") | |
{ | |
fileExt = u".pptx"; | |
} | |
else if (strProgId == u"Acrobat Document") | |
{ | |
fileExt = u".pdf"; | |
} | |
// Find the correct file name with file extension. | |
U16String fileName = outDir + u"outputExtractOleObject" + fileExt; | |
// Write the Ole object data with correct file name. | |
std::ofstream fout(fileName.ToUtf8(), std::ios::binary | std::ios::out); | |
if (!fout.is_open()) { | |
std::cerr << "Failed to open the file: " << fileName.ToUtf8() << std::endl; | |
continue; | |
} | |
const Vector<uint8_t>& data = oleObj.GetObjectData(); | |
fout.write(reinterpret_cast<char*>(data.GetData()), data.GetLength()); | |
fout.close(); | |
}//for | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleExtractingOLEObjectsFromWorksheet = srcDir->StringAppend(new String("sampleExtractingOLEObjectsFromWorksheet.xlsx")); | |
// Load sample Excel file containing OLE objects. | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleExtractingOLEObjectsFromWorksheet); | |
// Get the first worksheet. | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Create File object. | |
intrusive_ptr<Aspose::Cells::Systems::IO::File> ioFile = new Aspose::Cells::Systems::IO::File(); | |
// Access the count of Ole objects. | |
Aspose::Cells::Systems::Int32 oleCount = worksheet->GetIOleObjects()->GetCount(); | |
// Iterate all the Ole objects and save to disk with correct file format extension. | |
for (int i = 0; i < oleCount; i++) | |
{ | |
// Access Ole object. | |
intrusive_ptr<Aspose::Cells::Drawing::IOleObject> oleObj = worksheet->GetIOleObjects()->GetObjectByIndex(i); | |
// Access the Ole ProgID. | |
intrusive_ptr<Aspose::Cells::Systems::String> strProgId = oleObj->GetProgID(); | |
// Find the correct file extension. | |
intrusive_ptr<Aspose::Cells::Systems::String> fileExt = NULL; | |
if (strProgId->Equals(new String("Document")) == true) | |
{ | |
fileExt = new Aspose::Cells::Systems::String(".docx"); | |
} | |
else if (strProgId->Equals(new String("Presentation")) == true) | |
{ | |
fileExt = new Aspose::Cells::Systems::String(".pptx"); | |
} | |
else if (strProgId->Equals(new String("Acrobat Document")) == true) | |
{ | |
fileExt = new Aspose::Cells::Systems::String(".pdf"); | |
} | |
// Find the correct file name with file extension. | |
intrusive_ptr<Aspose::Cells::Systems::String> fileName = outDir->StringAppend(new String("outputExtractOleObject"))->StringAppend(fileExt); | |
// Write the Ole object data with correct file name. | |
intrusive_ptr<Aspose::Cells::Systems::IO::FileStream> fout = new Aspose::Cells::Systems::IO::FileStream(fileName, FileMode::FileMode_OpenOrCreate, FileAccess::FileAccess_Write); | |
fout->Write(oleObj->GetObjectData(), 0, oleObj->GetObjectData()->GetLength()); | |
fout->Close(); | |
}//for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Vector<uint8_t> GetDataFromFile(const char* file) | |
{ | |
// open a file | |
std::ifstream fileStream(file, std::ios::binary); | |
if (!fileStream.is_open()) { | |
std::cerr << "Failed to open the file: " << file << std::endl; | |
return Vector<uint8_t>(0); | |
} | |
// Get file size | |
fileStream.seekg(0, std::ios::end); | |
std::streampos fileSize = fileStream.tellg(); | |
fileStream.seekg(0, std::ios::beg); | |
// Read file contents into uint8_t array | |
uint8_t* buffer = new uint8_t[fileSize]; | |
fileStream.read(reinterpret_cast<char*>(buffer), fileSize); | |
fileStream.close(); | |
Vector<uint8_t>data(buffer, fileSize); | |
delete[] buffer; | |
return data; | |
} | |
...... | |
Aspose::Cells::Startup(); | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output Excel file. | |
U16String outputInsertingOLEObjectsIntoWorksheet = outDir + u"outputInsertingOLEObjectsIntoWorksheet.xlsx"; | |
// Instantiate a new workbook. | |
Workbook workbook; | |
// Get the first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Read Image for Ole Object into array of bytes. | |
U16String imagePath = srcDir + u"AsposeLogo.png"; | |
Vector<uint8_t>imageData = GetDataFromFile(imagePath.ToUtf8().c_str()); | |
// Read Ole Object into array of bytes. | |
U16String oleObjectPath = srcDir + u"inputInsertOleObject.xlsx"; | |
Vector<uint8_t> oleObjectData = GetDataFromFile(oleObjectPath.ToUtf8().c_str()); | |
// Add an Ole object into the worksheet with the image. | |
int idx = worksheet.GetOleObjects().Add(2, 2, 200, 220, imageData); | |
// Set the Ole object data. | |
OleObject oleObj = worksheet.GetOleObjects().Get(idx); | |
oleObj.SetObjectData(oleObjectData); | |
// Save the workbook. | |
workbook.Save(outputInsertingOLEObjectsIntoWorksheet); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output Excel file. | |
StringPtr outputInsertingOLEObjectsIntoWorksheet = outDir->StringAppend(new String("outputInsertingOLEObjectsIntoWorksheet.xlsx")); | |
// Instantiate a new workbook. | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get the first worksheet. | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Create File object. | |
intrusive_ptr<Aspose::Cells::Systems::IO::File> ioFile = new Aspose::Cells::Systems::IO::File(); | |
// Read Image for Ole Object into array of bytes. | |
StringPtr imagePath = srcDir->StringAppend(new String("AsposeLogo.png")); | |
intrusive_ptr<Array1D<Byte>> imageData = ioFile->ReadAllBytes(imagePath); | |
// Read Ole Object into array of bytes. | |
StringPtr oleObjectPath = srcDir->StringAppend(new String("inputInsertOleObject.xlsx")); | |
intrusive_ptr<Array1D<Byte>> oleObjectData = ioFile->ReadAllBytes(oleObjectPath); | |
// Add an Ole object into the worksheet with the image. | |
Aspose::Cells::Systems::Int32 idx = worksheet->GetIOleObjects()->Add(2, 2, 200, 220, imageData); | |
// Set the Ole object data. | |
intrusive_ptr<Aspose::Cells::Drawing::IOleObject> oleObj = worksheet->GetIOleObjects()->GetObjectByIndex(idx); | |
oleObj->SetObjectData(oleObjectData); | |
// Save the workbook. | |
workbook->Save(outputInsertingOLEObjectsIntoWorksheet); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
// Instantiate a new Workbook | |
Workbook wb; | |
// Get the first worksheet | |
WorksheetCollection wsc = wb.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
// open a file | |
std::ifstream fileStream(dirPath.ToUtf8() + "watermark.png", std::ios::binary); | |
if (!fileStream.is_open()) { | |
std::cerr << "Failed to open the file." << std::endl; | |
return 1; | |
} | |
// Get file size | |
fileStream.seekg(0, std::ios::end); | |
std::streampos fileSize = fileStream.tellg(); | |
fileStream.seekg(0, std::ios::beg); | |
// Read file contents into uint8_t array | |
uint8_t* buffer = new uint8_t[fileSize]; | |
fileStream.read(reinterpret_cast<char*>(buffer), fileSize); | |
fileStream.close(); | |
Vector<uint8_t>data(buffer, fileSize); | |
delete[] buffer; | |
// Set a picture as the Watermark. | |
ws.SetBackgroundImage(data); | |
// Save the file | |
wb.Save(outPath + u"Watermark_Pict.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AddPictureWarterMark() | |
{ | |
// Instantiate a new Workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
// Get the first worksheet | |
intrusive_ptr<IWorksheetCollection> wsc = wb->GetIWorksheets(); | |
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0); | |
// Set a picture as the Watermark. | |
ws->SetBackgroundImage(File::ReadAllBytes(new String("D:\\logo.png"))); | |
// Save the file | |
wb->Save(new String("Watermark_Pict.xlsx")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Instantiate a new Workbook | |
Workbook wb; | |
// Get the first worksheet | |
WorksheetCollection wsc = wb.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
// Add Text Watermark | |
Shape wordart = ws.GetShapes().AddTextEffect(MsoPresetTextEffect::TextEffect1, | |
u"CONFIDENTIAL", u"Arial Black", 50, false, true | |
, 18, 8, 1, 1, 130, 800); | |
// Get the fill format of the word art | |
FillFormat wordArtFormat = wordart.GetFill(); | |
// Set the transparency | |
wordArtFormat.SetTransparency(0.9); | |
// Save the file | |
wb.Save(u"Watermark_Text.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AddTextWarterMark() | |
{ | |
// Instantiate a new Workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
// Get the first worksheet | |
intrusive_ptr<IWorksheetCollection> wsc = wb->GetIWorksheets(); | |
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0); | |
// Add Text Watermark | |
intrusive_ptr<IShape> wordart = ws->GetIShapes()->AddITextEffect(MsoPresetTextEffect_TextEffect1, | |
new String("CONFIDENTIAL"), new String("Arial Black"), 50, false, true | |
, 18, 8, 1, 1, 130, 800); | |
// Get the fill format of the word art | |
intrusive_ptr<IFillFormat> wordArtFormat = wordart->GetIFillFormat(); | |
// Set the transparency | |
wordArtFormat->SetTransparency( 0.9); | |
// Save the file | |
wb->Save(new String("Watermark_Text.xlsx")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
// Instantiate a Workbook object and open an Excel file | |
Workbook workbook(dirPath + u"sample.xlsx"); | |
// Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Get the List objects collection in the first worksheet. | |
ListObjectCollection listObjects = worksheet.GetListObjects(); | |
// Convert the first table/list object (from the first worksheet) to normal range | |
listObjects.Get(0).ConvertToRange(); | |
// Saving the Excel file | |
workbook.Save(outPath + u"ConvertTableToRange_out.xls"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Instantiate a Workbook object and open an Excel file | |
intrusive_ptr<IWorkbook> workbook =Factory::CreateIWorkbook(dataDir_Tables->StringAppend(new String("sample.xlsx"))); | |
// Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Get the List objects collection in the first worksheet. | |
intrusive_ptr<IListObjectCollection> listObjects = worksheet->GetIListObjects(); | |
// Convert the first table/list object (from the first worksheet) to normal range | |
listObjects->GetObjectByIndex(0)->ConvertToRange(); | |
// Saving the Excel file | |
workbook->Save(dataDir_Tables->StringAppend(new String("ConvertTableToRange_out.xls"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
// Instantiate a Workbook object and open an Excel file | |
Workbook workbook(dirPath + u"book1.xls"); | |
// Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Get the List objects collection in the first worksheet. | |
ListObjectCollection listObjects = worksheet.GetListObjects(); | |
// Add a List based on the data source range with headers on. | |
listObjects.Add(1, 1, 7, 5, true); | |
// Show the total row for the List. | |
listObjects.Get(0).SetShowTotals(true); | |
// Saving the Excel file | |
workbook.Save(outPath + u"CreatingListObjects_out.xls"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Instantiate a Workbook object and open an Excel file | |
intrusive_ptr<IWorkbook> workbook =Factory::CreateIWorkbook(dataDir_Tables->StringAppend(new String("book1.xls"))); | |
// Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Get the List objects collection in the first worksheet. | |
intrusive_ptr<IListObjectCollection> listObjects = worksheet->GetIListObjects(); | |
// Add a List based on the data source range with headers on. | |
listObjects->Add(1, 1, 7, 5, true); | |
// Show the total row for the List. | |
listObjects->GetObjectByIndex(0)->SetShowTotals(true); | |
// Saving the Excel file | |
workbook->Save(dataDir_Tables->StringAppend(new String("CreatingListObjects_out.xls"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
// Instantiate a Workbook object | |
Workbook workbook; | |
// Obtaining the reference of the default(first) worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Obtaining Worksheet's cells collection | |
Cells cells = worksheet.GetCells(); | |
// Setting the value to the cells | |
cells.Get(u"A1").PutValue(u"Employee"); | |
cells.Get(u"B1").PutValue(u"Quarter"); | |
cells.Get(u"C1").PutValue(u"Product"); | |
cells.Get(u"D1").PutValue(u"Continent"); | |
cells.Get(u"E1").PutValue(u"Country"); | |
cells.Get(u"F1").PutValue(u"Sale"); | |
cells.Get(u"A2").PutValue(u"David"); | |
cells.Get(u"A3").PutValue(u"David"); | |
cells.Get(u"A4").PutValue(u"David"); | |
cells.Get(u"A5").PutValue(u"David"); | |
cells.Get(u"A6").PutValue(u"James"); | |
cells.Get(u"A7").PutValue(u"James"); | |
cells.Get(u"A8").PutValue(u"James"); | |
cells.Get(u"A9").PutValue(u"James"); | |
cells.Get(u"A10").PutValue(u"James"); | |
cells.Get(u"A11").PutValue(u"Miya"); | |
cells.Get(u"A12").PutValue(u"Miya"); | |
cells.Get(u"A13").PutValue(u"Miya"); | |
cells.Get(u"A14").PutValue(u"Miya"); | |
cells.Get(u"A15").PutValue(u"Miya"); | |
cells.Get(u"B2").PutValue(1); | |
cells.Get(u"B3").PutValue(2); | |
cells.Get(u"B4").PutValue(3); | |
cells.Get(u"B5").PutValue(4); | |
cells.Get(u"B6").PutValue(1); | |
cells.Get(u"B7").PutValue(2); | |
cells.Get(u"B8").PutValue(3); | |
cells.Get(u"B9").PutValue(4); | |
cells.Get(u"B10").PutValue(4); | |
cells.Get(u"B11").PutValue(1); | |
cells.Get(u"B12").PutValue(1); | |
cells.Get(u"B13").PutValue(2); | |
cells.Get(u"B14").PutValue(2); | |
cells.Get(u"B15").PutValue(2); | |
cells.Get(u"C2").PutValue(u"Maxilaku"); | |
cells.Get(u"C3").PutValue(u"Maxilaku"); | |
cells.Get(u"C4").PutValue(u"Chai"); | |
cells.Get(u"C5").PutValue(u"Maxilaku"); | |
cells.Get(u"C6").PutValue(u"Chang"); | |
cells.Get(u"C7").PutValue(u"Chang"); | |
cells.Get(u"C8").PutValue(u"Chang"); | |
cells.Get(u"C9").PutValue(u"Chang"); | |
cells.Get(u"C10").PutValue(u"Chang"); | |
cells.Get(u"C11").PutValue(u"Geitost"); | |
cells.Get(u"C12").PutValue(u"Chai"); | |
cells.Get(u"C13").PutValue(u"Geitost"); | |
cells.Get(u"C14").PutValue(u"Geitost"); | |
cells.Get(u"C15").PutValue(u"Geitost"); | |
cells.Get(u"D2").PutValue(u"Asia"); | |
cells.Get(u"D3").PutValue(u"Asia"); | |
cells.Get(u"D4").PutValue(u"Asia"); | |
cells.Get(u"D5").PutValue(u"Asia"); | |
cells.Get(u"D6").PutValue(u"Europe"); | |
cells.Get(u"D7").PutValue(u"Europe"); | |
cells.Get(u"D8").PutValue(u"Europe"); | |
cells.Get(u"D9").PutValue(u"Europe"); | |
cells.Get(u"D10").PutValue(u"Europe"); | |
cells.Get(u"D11").PutValue(u"America"); | |
cells.Get(u"D12").PutValue(u"America"); | |
cells.Get(u"D13").PutValue(u"America"); | |
cells.Get(u"D14").PutValue(u"America"); | |
cells.Get(u"D15").PutValue(u"America"); | |
cells.Get(u"E2").PutValue(u"China"); | |
cells.Get(u"E3").PutValue(u"India"); | |
cells.Get(u"E4").PutValue(u"Korea"); | |
cells.Get(u"E5").PutValue(u"India"); | |
cells.Get(u"E6").PutValue(u"France"); | |
cells.Get(u"E7").PutValue(u"France"); | |
cells.Get(u"E8").PutValue(u"Germany"); | |
cells.Get(u"E9").PutValue(u"Italy"); | |
cells.Get(u"E10").PutValue(u"France"); | |
cells.Get(u"E11").PutValue(u"U.S."); | |
cells.Get(u"E12").PutValue(u"U.S."); | |
cells.Get(u"E13").PutValue(u"Brazil"); | |
cells.Get(u"E14").PutValue(u"U.S."); | |
cells.Get(u"E15").PutValue(u"U.S."); | |
cells.Get(u"F2").PutValue(2000); | |
cells.Get(u"F3").PutValue(500); | |
cells.Get(u"F4").PutValue(1200); | |
cells.Get(u"F5").PutValue(1500); | |
cells.Get(u"F6").PutValue(500); | |
cells.Get(u"F7").PutValue(1500); | |
cells.Get(u"F8").PutValue(800); | |
cells.Get(u"F9").PutValue(900); | |
cells.Get(u"F10").PutValue(500); | |
cells.Get(u"F11").PutValue(1600); | |
cells.Get(u"F12").PutValue(600); | |
cells.Get(u"F13").PutValue(2000); | |
cells.Get(u"F14").PutValue(500); | |
cells.Get(u"F15").PutValue(900); | |
// Adding a new List Object to the worksheet | |
worksheet.GetListObjects().Add(u"A1", u"F15", true); | |
ListObject listObject = worksheet.GetListObjects().Get(0); | |
// Adding Default Style to the table | |
listObject.SetTableStyleType(TableStyleType::TableStyleMedium10); | |
// Show Total | |
listObject.SetShowTotals(true); | |
// Saving the Excel file | |
workbook.Save(outPath + u"FormatTable_out.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Instantiate a Workbook object | |
intrusive_ptr<IWorkbook> workbook =Factory::CreateIWorkbook(); | |
// Obtaining the reference of the default(first) worksheet | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Obtaining Worksheet's cells collection | |
intrusive_ptr<ICells> cells = worksheet->GetICells(); | |
// Setting the value to the cells | |
cells->GetObjectByIndex(new String("A1"))->PutValue("Employee"); | |
cells->GetObjectByIndex(new String("B1"))->PutValue("Quarter"); | |
cells->GetObjectByIndex(new String("C1"))->PutValue("Product"); | |
cells->GetObjectByIndex(new String("D1"))->PutValue("Continent"); | |
cells->GetObjectByIndex(new String("E1"))->PutValue("Country"); | |
cells->GetObjectByIndex(new String("F1"))->PutValue("Sale"); | |
cells->GetObjectByIndex(new String("A2"))->PutValue("David"); | |
cells->GetObjectByIndex(new String("A3"))->PutValue("David"); | |
cells->GetObjectByIndex(new String("A4"))->PutValue("David"); | |
cells->GetObjectByIndex(new String("A5"))->PutValue("David"); | |
cells->GetObjectByIndex(new String("A6"))->PutValue("James"); | |
cells->GetObjectByIndex(new String("A7"))->PutValue("James"); | |
cells->GetObjectByIndex(new String("A8"))->PutValue("James"); | |
cells->GetObjectByIndex(new String("A9"))->PutValue("James"); | |
cells->GetObjectByIndex(new String("A10"))->PutValue("James"); | |
cells->GetObjectByIndex(new String("A11"))->PutValue("Miya"); | |
cells->GetObjectByIndex(new String("A12"))->PutValue("Miya"); | |
cells->GetObjectByIndex(new String("A13"))->PutValue("Miya"); | |
cells->GetObjectByIndex(new String("A14"))->PutValue("Miya"); | |
cells->GetObjectByIndex(new String("A15"))->PutValue("Miya"); | |
cells->GetObjectByIndex(new String("B2"))->PutValue(1); | |
cells->GetObjectByIndex(new String("B3"))->PutValue(2); | |
cells->GetObjectByIndex(new String("B4"))->PutValue(3); | |
cells->GetObjectByIndex(new String("B5"))->PutValue(4); | |
cells->GetObjectByIndex(new String("B6"))->PutValue(1); | |
cells->GetObjectByIndex(new String("B7"))->PutValue(2); | |
cells->GetObjectByIndex(new String("B8"))->PutValue(3); | |
cells->GetObjectByIndex(new String("B9"))->PutValue(4); | |
cells->GetObjectByIndex(new String("B10"))->PutValue(4); | |
cells->GetObjectByIndex(new String("B11"))->PutValue(1); | |
cells->GetObjectByIndex(new String("B12"))->PutValue(1); | |
cells->GetObjectByIndex(new String("B13"))->PutValue(2); | |
cells->GetObjectByIndex(new String("B14"))->PutValue(2); | |
cells->GetObjectByIndex(new String("B15"))->PutValue(2); | |
cells->GetObjectByIndex(new String("C2"))->PutValue("Maxilaku"); | |
cells->GetObjectByIndex(new String("C3"))->PutValue("Maxilaku"); | |
cells->GetObjectByIndex(new String("C4"))->PutValue("Chai"); | |
cells->GetObjectByIndex(new String("C5"))->PutValue("Maxilaku"); | |
cells->GetObjectByIndex(new String("C6"))->PutValue("Chang"); | |
cells->GetObjectByIndex(new String("C7"))->PutValue("Chang"); | |
cells->GetObjectByIndex(new String("C8"))->PutValue("Chang"); | |
cells->GetObjectByIndex(new String("C9"))->PutValue("Chang"); | |
cells->GetObjectByIndex(new String("C10"))->PutValue("Chang"); | |
cells->GetObjectByIndex(new String("C11"))->PutValue("Geitost"); | |
cells->GetObjectByIndex(new String("C12"))->PutValue("Chai"); | |
cells->GetObjectByIndex(new String("C13"))->PutValue("Geitost"); | |
cells->GetObjectByIndex(new String("C14"))->PutValue("Geitost"); | |
cells->GetObjectByIndex(new String("C15"))->PutValue("Geitost"); | |
cells->GetObjectByIndex(new String("D2"))->PutValue("Asia"); | |
cells->GetObjectByIndex(new String("D3"))->PutValue("Asia"); | |
cells->GetObjectByIndex(new String("D4"))->PutValue("Asia"); | |
cells->GetObjectByIndex(new String("D5"))->PutValue("Asia"); | |
cells->GetObjectByIndex(new String("D6"))->PutValue("Europe"); | |
cells->GetObjectByIndex(new String("D7"))->PutValue("Europe"); | |
cells->GetObjectByIndex(new String("D8"))->PutValue("Europe"); | |
cells->GetObjectByIndex(new String("D9"))->PutValue("Europe"); | |
cells->GetObjectByIndex(new String("D10"))->PutValue("Europe"); | |
cells->GetObjectByIndex(new String("D11"))->PutValue("America"); | |
cells->GetObjectByIndex(new String("D12"))->PutValue("America"); | |
cells->GetObjectByIndex(new String("D13"))->PutValue("America"); | |
cells->GetObjectByIndex(new String("D14"))->PutValue("America"); | |
cells->GetObjectByIndex(new String("D15"))->PutValue("America"); | |
cells->GetObjectByIndex(new String("E2"))->PutValue("China"); | |
cells->GetObjectByIndex(new String("E3"))->PutValue("India"); | |
cells->GetObjectByIndex(new String("E4"))->PutValue("Korea"); | |
cells->GetObjectByIndex(new String("E5"))->PutValue("India"); | |
cells->GetObjectByIndex(new String("E6"))->PutValue("France"); | |
cells->GetObjectByIndex(new String("E7"))->PutValue("France"); | |
cells->GetObjectByIndex(new String("E8"))->PutValue("Germany"); | |
cells->GetObjectByIndex(new String("E9"))->PutValue("Italy"); | |
cells->GetObjectByIndex(new String("E10"))->PutValue("France"); | |
cells->GetObjectByIndex(new String("E11"))->PutValue("U.S."); | |
cells->GetObjectByIndex(new String("E12"))->PutValue("U.S."); | |
cells->GetObjectByIndex(new String("E13"))->PutValue("Brazil"); | |
cells->GetObjectByIndex(new String("E14"))->PutValue("U.S."); | |
cells->GetObjectByIndex(new String("E15"))->PutValue("U.S."); | |
cells->GetObjectByIndex(new String("F2"))->PutValue(2000); | |
cells->GetObjectByIndex(new String("F3"))->PutValue(500); | |
cells->GetObjectByIndex(new String("F4"))->PutValue(1200); | |
cells->GetObjectByIndex(new String("F5"))->PutValue(1500); | |
cells->GetObjectByIndex(new String("F6"))->PutValue(500); | |
cells->GetObjectByIndex(new String("F7"))->PutValue(1500); | |
cells->GetObjectByIndex(new String("F8"))->PutValue(800); | |
cells->GetObjectByIndex(new String("F9"))->PutValue(900); | |
cells->GetObjectByIndex(new String("F10"))->PutValue(500); | |
cells->GetObjectByIndex(new String("F11"))->PutValue(1600); | |
cells->GetObjectByIndex(new String("F12"))->PutValue(600); | |
cells->GetObjectByIndex(new String("F13"))->PutValue(2000); | |
cells->GetObjectByIndex(new String("F14"))->PutValue(500); | |
cells->GetObjectByIndex(new String("F15"))->PutValue(900); | |
// Adding a new List Object to the worksheet | |
worksheet->GetIListObjects()->Add(new String("A1"), new String("F15"), true); | |
intrusive_ptr<IListObject> listObject = worksheet->GetIListObjects()->GetObjectByIndex(0); | |
// Adding Default Style to the table | |
listObject->SetTableStyleType(TableStyleType_TableStyleMedium10); | |
// Show Total | |
listObject->SetShowTotals(true); | |
// Saving the Excel file | |
workbook->Save(dataDir_Tables->StringAppend(new String("FormatTable_out.xlsx"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
U16String name = CellsHelper::CellIndexToName(3, 5); | |
std::cout << name.ToUtf8() << std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
intrusive_ptr<ICellsHelper> cellsHelper = new ICellsHelper(); | |
String name = cellsHelper->CellIndexToName_i(3, 5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int row; | |
int column; | |
CellsHelper::CellNameToIndex(u"C4", row, column); | |
std::cout << "row = " << row << std::endl; | |
std::cout << "column = " << column << std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
int row; | |
int column; | |
intrusive_ptr<ICellsHelper> cellsHelper = new ICellsHelper(); | |
cellsHelper->CellNameToIndex_i(new String("C4"), row, column); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
// Instantiate a Workbook object and open an Excel file | |
Workbook workbook(dirPath + u"source.xlsx"); | |
// Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Get the List objects collection in the first worksheet. | |
ListObjectCollection listObjects = worksheet.GetListObjects(); | |
// Set the comment of the first list object | |
listObjects.Get(0).SetComment(u"This is Aspose.Cells comment."); | |
// Saving the Excel file | |
workbook.Save(outPath + u"SetCommentOfTableOrListObject_out.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Instantiate a Workbook object and open an Excel file | |
intrusive_ptr<IWorkbook> workbook =Factory::CreateIWorkbook(dataDir_Tables->StringAppend(new String("source.xlsx"))); | |
// Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Get the List objects collection in the first worksheet. | |
intrusive_ptr<IListObjectCollection> listObjects = worksheet->GetIListObjects(); | |
// Set the comment of the first list object | |
listObjects->GetObjectByIndex(0)->SetComment(new String("This is Aspose.Cells comment.")); | |
// Saving the Excel file | |
workbook->Save(dataDir_Tables->StringAppend(new String("SetCommentOfTableOrListObject_out.xlsx")), SaveFormat_Xlsx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String samplePrecedentsAndDependents = dirPath + u"samplePrecedentsAndDependents.xlsx"; | |
//Load source Excel file | |
Workbook workbook(samplePrecedentsAndDependents); | |
//Calculate workbook formula | |
workbook.CalculateFormula(); | |
//Access first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Access cell F6 | |
Cell cell = worksheet.GetCells().Get(u"F6"); | |
//Get dependents of the cells and print them on console | |
std::cout << "Printing Dependents of Cell: "; | |
std::cout << cell.GetName().ToUtf8() << std::endl; | |
std::cout << "-------------------------------" << std::endl; | |
//Parameter false means we do not want to search other sheets | |
Vector<Cell> depCells = cell.GetDependents(false); | |
//Get the length of the array | |
int len = depCells.GetLength(); | |
//Print the names of all the cells inside the array | |
for (int i = 0; i < len; i++) | |
{ | |
Cell dCell = depCells[i]; | |
std::cout << dCell.GetName().ToUtf8() << std::endl; | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr samplePrecedentsAndDependents = dirPath->StringAppend(new String("samplePrecedentsAndDependents.xlsx")); | |
//Load source Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(samplePrecedentsAndDependents); | |
//Calculate workbook formula | |
workbook->CalculateFormula(); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell F6 | |
intrusive_ptr<ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("F6")); | |
//Get dependents of the cells and print them on console | |
Console::Write(new String("Printing Dependents of Cell: ")); | |
Console::Write(cell->GetName()); | |
Console::WriteLine(new String("")); | |
Console::WriteLine(new String("-------------------------------")); | |
//Parameter false means we do not want to search other sheets | |
intrusive_ptr<Aspose::Cells::Systems::Array1D<ICell*>> depCells = cell->GetDependentICells(false); | |
//Get the length of the array | |
int len = depCells->Length(); | |
//Print the names of all the cells inside the array | |
for (int i = 0; i < len; i++) | |
{ | |
intrusive_ptr<ICell> dCell = depCells->At(i); | |
Console::WriteLine(dCell->GetName()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String samplePrecedentsAndDependents = dirPath + u"samplePrecedentsAndDependents.xlsx"; | |
//Load source Excel file | |
Workbook workbook(samplePrecedentsAndDependents); | |
//Calculate workbook formula | |
workbook.CalculateFormula(); | |
//Access first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Access cell F6 | |
Cell cell = worksheet.GetCells().Get(u"F6"); | |
//Get precedents of the cells and print them on console | |
std::cout << "Printing Precedents of Cell: "; | |
std::cout << cell.GetName().ToUtf8() << std::endl; | |
std::cout << u"-------------------------------" << std::endl; | |
ReferredAreaCollection refac = cell.GetPrecedents(); | |
int count = refac.GetCount(); | |
for (int i = 0; i < count; i++) | |
{ | |
ReferredArea refa = refac.Get(i); | |
int row = refa.GetStartRow(); | |
int col = refa.GetStartColumn(); | |
cell = worksheet.GetCells().GetCell(row, col); | |
std::cout<<cell.GetName().ToUtf8() << std::endl; | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr samplePrecedentsAndDependents = dirPath->StringAppend(new String("samplePrecedentsAndDependents.xlsx")); | |
//Load source Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(samplePrecedentsAndDependents); | |
//Calculate workbook formula | |
workbook->CalculateFormula(); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell F6 | |
intrusive_ptr<ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("F6")); | |
//Get precedents of the cells and print them on console | |
Console::Write(new String("Printing Precedents of Cell: ")); | |
Console::Write(cell->GetName()); | |
Console::WriteLine(new String("")); | |
Console::WriteLine(new String("-------------------------------")); | |
intrusive_ptr<IReferredAreaCollection> refac = cell->GetIPrecedents(); | |
int count = refac->GetCount(); | |
for (int i = 0; i < count; i++) | |
{ | |
intrusive_ptr<IReferredArea> refa = refac->GetObjectByIndex(i); | |
int row = refa->GetStartRow(); | |
int col = refa->GetStartColumn(); | |
cell = worksheet->GetICells()->GetICell(row,col); | |
Console::WriteLine(cell->GetName()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleData = dirPath + u"sampleData.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Get cells from sheet | |
Cells cells = worksheet.GetCells(); | |
//Accessing a cell using its name | |
Cell cell = cells.Get(u"B3"); | |
//Write string value of the cell on console | |
std::cout << "Value of cell B3: " | |
<< cell.GetStringValue().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleData = dirPath->StringAppend(new String("sampleData.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Get cells from sheet | |
intrusive_ptr<ICells> cells = worksheet->GetICells(); | |
//Accessing a cell using its name | |
intrusive_ptr<ICell> cell = cells->GetObjectByIndex(new String("B3")); | |
//Write string value of the cell on console | |
Console::Write(new String("Value of cell B3: ")); | |
Console::WriteLine(cell->GetStringValue()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleData = dirPath + u"sampleData.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Get cells from sheet | |
Cells cells = worksheet.GetCells(); | |
//Accessing cell B3 using its row and column index | |
Cell cell = cells.Get(2, 1); | |
//Write string value of the cell on console | |
std::cout << "Value of cell B3: " | |
<< cell.GetStringValue().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleData = dirPath->StringAppend(new String("sampleData.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Get cells from sheet | |
intrusive_ptr<ICells> cells = worksheet->GetICells(); | |
//Accessing cell B3 using its row and column index | |
intrusive_ptr<ICell> cell = cells->GetObjectByIndex(2, 1); | |
//Write string value of the cell on console | |
Console::Write(new String("Value of cell B3: ")); | |
Console::WriteLine(cell->GetStringValue()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleData = dirPath + u"sampleData.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Get cells from sheet | |
Cells cells = worksheet.GetCells(); | |
//Access the Maximum Display Range | |
Range range = cells.GetMaxDisplayRange(); | |
//Print string value of the cell on console | |
std::cout << "Maximum Display Range of Worksheet: " | |
<< range.GetRefersTo().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleData = dirPath->StringAppend(new String("sampleData.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleData); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Get cells from sheet | |
intrusive_ptr<ICells> cells = worksheet->GetICells(); | |
//Access the Maximum Display Range | |
intrusive_ptr<IRange> range = cells->GetMaxDisplayIRange(); | |
//Print string value of the cell on console | |
Console::Write(new String("Maximum Display Range of Worksheet: ")); | |
Console::WriteLine(range->GetRefersTo()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleData = dirPath + u"sampleData.xlsx"; | |
//Path of output excel file | |
U16String outputData = outPath + u"outputData.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleData); | |
//Accessing the second worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(1); | |
//Adding a string value to the cell | |
worksheet.GetCells().Get(u"A1").PutValue(u"Hello World"); | |
//Adding a double value to the cell | |
worksheet.GetCells().Get(u"A2").PutValue(20.5); | |
//Adding an integer value to the cell | |
worksheet.GetCells().Get(u"A3").PutValue(15); | |
//Adding a boolean value to the cell | |
worksheet.GetCells().Get(u"A4").PutValue(true); | |
//Setting the display format of the date | |
Cell cell = worksheet.GetCells().Get(u"A5"); | |
Style style = cell.GetStyle(); | |
style.SetNumber(15); | |
cell.SetStyle(style); | |
//Save the workbook | |
workbook.Save(outputData); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleData = dirPath->StringAppend(new String("sampleData.xlsx")); | |
//Path of output excel file | |
StringPtr outputData = outPath->StringAppend(new String("outputData.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleData); | |
//Accessing the second worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(1); | |
//Adding a string value to the cell | |
worksheet->GetICells()->GetObjectByIndex(new String("A1"))->PutValue("Hello World"); | |
//Adding a double value to the cell | |
worksheet->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(20.5); | |
//Adding an integer value to the cell | |
worksheet->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(15); | |
//Adding a boolean value to the cell | |
worksheet->GetICells()->GetObjectByIndex(new String("A4"))->PutValue(true); | |
//Setting the display format of the date | |
intrusive_ptr<ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("A5")); | |
intrusive_ptr<IStyle> style = cell->GetIStyle(); | |
style->SetNumber(15); | |
cell->SetIStyle(style); | |
//Save the workbook | |
workbook->Save(outputData); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleData = dirPath + u"sampleData.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleData); | |
//Accessing the third worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(2); | |
//Get cells from sheet | |
Cells cells = worksheet.GetCells(); | |
//Variable declarations | |
U16String strVal; | |
Date dateVal; | |
double dblVal; | |
bool boolVal; | |
Enumerator<Cell> enCell = cells.GetEnumerator(); | |
while (enCell.MoveNext()) | |
{ | |
Cell cell = enCell.GetCurrent(); | |
switch (cell.GetType()) | |
{ | |
//Evaluating the data type of the cell data for string value | |
case CellValueType::IsString: | |
std::cout <<"Cell Value Type Is String." << std::endl; | |
strVal = cell.GetStringValue(); | |
break; | |
//Evaluating the data type of the cell data for double value | |
case CellValueType::IsNumeric: | |
std::cout <<"Cell Value Type Is Numeric." << std::endl; | |
dblVal = cell.GetDoubleValue(); | |
break; | |
//Evaluating the data type of the cell data for boolean value | |
case CellValueType::IsBool: | |
std::cout <<"Cell Value Type Is Bool." << std::endl; | |
boolVal = cell.GetBoolValue(); | |
break; | |
//Evaluating the data type of the cell data for date/time value | |
case CellValueType::IsDateTime: | |
std::cout <<"Cell Value Type Is DateTime." << std::endl; | |
dateVal = cell.GetDateTimeValue(); | |
break; | |
//Evaluating the unknown data type of the cell data | |
case CellValueType::IsUnknown: | |
cell.GetStringValue(); | |
break; | |
default: | |
break; | |
} | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleData = dirPath->StringAppend(new String("sampleData.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleData); | |
//Accessing the third worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(2); | |
//Get cells from sheet | |
intrusive_ptr<ICells> cells = worksheet->GetICells(); | |
//Variable declarations | |
intrusive_ptr<String> strVal; | |
intrusive_ptr<Aspose::Cells::System::DateTime> dateVal; | |
Aspose::Cells::System::Double dblVal; | |
Aspose::Cells::System::Boolean boolVal; | |
for (int i = 0; i < cells->GetCount(); i++) | |
{ | |
intrusive_ptr<ICell> cell = cells->GetObjectByIndex(i); | |
switch (cell->GetType()) | |
{ | |
//Evaluating the data type of the cell data for string value | |
case CellValueType_IsString: | |
Console::WriteLine(new String("Cell Value Type Is String.")); | |
strVal = cell->GetStringValue(); | |
break; | |
//Evaluating the data type of the cell data for double value | |
case CellValueType_IsNumeric: | |
Console::WriteLine(new String("Cell Value Type Is Numeric.")); | |
dblVal = cell->GetDoubleValue(); | |
break; | |
//Evaluating the data type of the cell data for boolean value | |
case CellValueType_IsBool: | |
Console::WriteLine(new String("Cell Value Type Is Bool.")); | |
boolVal = cell->GetBoolValue(); | |
break; | |
//Evaluating the data type of the cell data for date/time value | |
case CellValueType_IsDateTime: | |
Console::WriteLine(new String("Cell Value Type Is DateTime.")); | |
dateVal = cell->GetDateTimeValue(); | |
break; | |
//Evaluating the unknown data type of the cell data | |
case CellValueType_IsUnknown: | |
cell->GetStringValue(); | |
break; | |
default: | |
break; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of output excel file | |
U16String outputAddHyperlinksToTheCells = outPath + u"outputAddHyperlinksToTheCells.xlsx"; | |
//Create a new workbook | |
Workbook workbook; | |
//Get the first worksheet | |
WorksheetCollection wsc = workbook.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
//Add hyperlink in cell C7 and make use of its various methods | |
HyperlinkCollection hypLnks = ws.GetHyperlinks(); | |
int idx = hypLnks.Add(u"C7", 1, 1, u"http://www.aspose.com/"); | |
Hyperlink lnk = hypLnks.Get(idx); | |
lnk.SetTextToDisplay(u"Aspose"); | |
lnk.SetScreenTip(u"Link to Aspose Website"); | |
//Save the workbook | |
workbook.Save(outputAddHyperlinksToTheCells); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of output excel file | |
StringPtr outputAddHyperlinksToTheCells = outPath->StringAppend(new String("outputAddHyperlinksToTheCells.xlsx")); | |
//Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
//Get the first worksheet | |
intrusive_ptr<IWorksheetCollection> wsc = workbook->GetIWorksheets(); | |
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0); | |
//Add hyperlink in cell C7 and make use of its various methods | |
intrusive_ptr<IHyperlinkCollection> hypLnks = ws->GetIHyperlinks(); | |
int idx = hypLnks->Add(new String("C7"), 1, 1, new String("http://www.aspose.com/")); | |
intrusive_ptr<IHyperlink> lnk = hypLnks->GetObjectByIndex(idx); | |
lnk->SetTextToDisplay(new String("Aspose")); | |
lnk->SetScreenTip(new String("Link to Aspose Website")); | |
//Save the workbook | |
workbook->Save(outputAddHyperlinksToTheCells); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of output excel file | |
U16String outputApplyConditionalFormattingInWorksheet = outPath + u"outputApplyConditionalFormattingInWorksheet.xlsx"; | |
//Create an empty workbook | |
Workbook wb; | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Adds an empty conditional formatting | |
int idx = ws.GetConditionalFormattings().Add(); | |
FormatConditionCollection fcs = ws.GetConditionalFormattings().Get(idx); | |
//Set the conditional format range | |
CellArea ca = CellArea::CreateCellArea(u"A1", u"A1"); | |
fcs.AddArea(ca); | |
ca = CellArea::CreateCellArea(u"B2", u"B2"); | |
fcs.AddArea(ca); | |
//Add condition and set the background color | |
idx = fcs.AddCondition(FormatConditionType::CellValue, OperatorType::Between, u"=A2", u"100"); | |
FormatCondition fc = fcs.Get(idx); | |
fc.GetStyle().SetBackgroundColor(Color{ 0xff,0xff ,0 ,0 });//Red | |
//User friendly message to test the output excel file. | |
U16String msgStr = u"Red color in cells A1 and B2 is because of Conditional Formatting. Put 101 or any value >100 in cell A2 and B2, you will see Red background color will be gone."; | |
ws.GetCells().Get(u"A10").PutValue(msgStr); | |
//Save the output excel file | |
wb.Save(outputApplyConditionalFormattingInWorksheet); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of output excel file | |
StringPtr outputApplyConditionalFormattingInWorksheet = outPath->StringAppend(new String("outputApplyConditionalFormattingInWorksheet.xlsx")); | |
//Create an empty workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Adds an empty conditional formatting | |
int idx = ws->GetIConditionalFormattings()->Add(); | |
intrusive_ptr<IFormatConditionCollection> fcs = ws->GetIConditionalFormattings()->GetObjectByIndex(idx); | |
//Set the conditional format range | |
intrusive_ptr<ICellArea> ca = ICellArea::CreateICellArea(new String("A1"), new String("A1")); | |
fcs->AddArea(ca); | |
ca = ICellArea::CreateICellArea(new String("B2"), new String("B2")); | |
fcs->AddArea(ca); | |
//Add condition and set the background color | |
idx = fcs->AddCondition(FormatConditionType_CellValue, OperatorType_Between, new String("=A2"), new String("100")); | |
intrusive_ptr<IFormatCondition> fc = fcs->GetObjectByIndex(idx); | |
fc->GetIStyle()->SetBackgroundColor(Systems::Drawing::Color::GetRed()); | |
//User friendly message to test the output excel file. | |
StringPtr msgStr = new String("Red color in cells A1 and B2 is because of Conditional Formatting. Put 101 or any value >100 in cell A2 and B2, you will see Red background color will be gone."); | |
ws->GetICells()->GetObjectByIndex(new String("A10"))->PutValue(msgStr); | |
//Save the output excel file | |
wb->Save(outputApplyConditionalFormattingInWorksheet); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of output excel file | |
U16String outputFormatCellOrRangeOfCells = outPath + "outputFormatCellOrRangeOfCells.xlsx"; | |
//Create a new workbook | |
Workbook wb; | |
//Get first worksheet which is created by default | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Access cell C4 by cell name | |
Cell cell = ws.GetCells().Get(u"C4"); | |
//Add some text in cell | |
cell.PutValue((U16String)u"This is sample data."); | |
//Access the cell style | |
Style st = cell.GetStyle(); | |
//Fille the cell color to Yellow | |
st.SetPattern(BackgroundType::Solid); | |
st.SetForegroundColor(Color{ 0xff, 0xff, 0xff, 0 });//Yellow | |
//Set the text to wrapp | |
st.SetIsTextWrapped(true); | |
//Set the left and right border to Red | |
st.SetBorder(BorderType::LeftBorder, CellBorderType::Thick, Color{ 0xff, 0xff, 0, 0 });//Red | |
st.SetBorder(BorderType::RightBorder, CellBorderType::Thick, Color{ 0xff, 0xff, 0, 0 });//Red | |
//Set font color, font size, strike, bold, italic | |
st.GetFont().SetColor(Color{ 0xff, 0, 0, 0xff });//Blue | |
st.GetFont().SetSize(16); | |
st.GetFont().SetStrikeType(TextStrikeType::Single); | |
st.GetFont().SetIsBold(true); | |
st.GetFont().SetIsItalic(true); | |
//Set text horizontal and vertical alignment to center | |
st.SetHorizontalAlignment(TextAlignmentType::Center); | |
st.SetVerticalAlignment(TextAlignmentType::Center); | |
//Set the cell style | |
cell.SetStyle(st); | |
//Set the cell column width and row height | |
ws.GetCells().SetColumnWidth(cell.GetColumn(), 20); | |
ws.GetCells().SetRowHeight(cell.GetRow(), 70); | |
//Save the output excel file | |
wb.Save(outputFormatCellOrRangeOfCells); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of output excel file | |
StringPtr outputFormatCellOrRangeOfCells = outPath->StringAppend(new String("outputFormatCellOrRangeOfCells.xlsx")); | |
//Create a new workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell C4 by cell name | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("C4")); | |
//Add some text in cell | |
cell->PutValue((StringPtr)new String("This is sample data.")); | |
//Access the cell style | |
intrusive_ptr<IStyle> st = cell->GetIStyle(); | |
//Fille the cell color to Yellow | |
st->SetPattern(BackgroundType_Solid); | |
st->SetForegroundColor(Systems::Drawing::Color::GetYellow()); | |
//Set the text to wrapp | |
st->SetTextWrapped(true); | |
//Set the left and right border to Red | |
st->SetBorder(BorderType_LeftBorder, CellBorderType_Thick, Systems::Drawing::Color::GetRed()); | |
st->SetBorder(BorderType_RightBorder, CellBorderType_Thick, Systems::Drawing::Color::GetRed()); | |
//Set font color, font size, strike, bold, italic | |
st->GetIFont()->SetColor(Systems::Drawing::Color::GetBlue()); | |
st->GetIFont()->SetSize(16); | |
st->GetIFont()->SetStrikeType(TextStrikeType_Single); | |
st->GetIFont()->SetBold(true); | |
st->GetIFont()->SetItalic(true); | |
//Set text horizontal and vertical alignment to center | |
st->SetHorizontalAlignment(TextAlignmentType_Center); | |
st->SetVerticalAlignment(TextAlignmentType_Center); | |
//Set the cell style | |
cell->SetIStyle(st); | |
//Set the cell column width and row height | |
ws->GetICells()->SetColumnWidth(cell->GetColumn(), 20); | |
ws->GetICells()->SetRowHeight(cell->GetRow(), 70); | |
//Save the output excel file | |
wb->Save(outputFormatCellOrRangeOfCells); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of output excel file | |
U16String outputCreateNamedRange = outPath + "outputCreateNamedRange.xlsx"; | |
//Create a workbook | |
Workbook wb; | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Create a range | |
Range rng = ws.GetCells().CreateRange(u"A5:C10"); | |
//Set its name to make it named range | |
rng.SetName(u"MyNamedRange"); | |
//Read the named range created above from names collection | |
Name nm = wb.GetWorksheets().GetNames().Get(0); | |
//Print its FullText and RefersTo memebers | |
std::cout << "Full Text : " << nm.GetFullText().ToUtf8() << std::endl; | |
std::cout << "Refers To: " << nm.GetRefersTo().ToUtf8() << std::endl; | |
//Save the workbook in xlsx format | |
wb.Save(outputCreateNamedRange, SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of output excel file | |
StringPtr outputCreateNamedRange = dirPath->StringAppend(new String("outputCreateNamedRange.xlsx")); | |
//Create a workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Create a range | |
intrusive_ptr<IRange> rng = ws->GetICells()->CreateIRange((intrusive_ptr<String>)new String("A5:C10")); | |
//Set its name to make it named range | |
rng->SetName((intrusive_ptr<String>)new String("MyNamedRange")); | |
//Read the named range created above from names collection | |
intrusive_ptr<IName> nm = wb->GetIWorksheets()->GetINames()->GetObjectByIndex(0); | |
//Print its FullText and RefersTo memebers | |
StringPtr fullTect = new String("Full Text : "); | |
Console::WriteLine(fullTect->StringAppend(nm->GetFullText())); | |
StringPtr referTo = new String("Refers To: "); | |
Console::WriteLine(referTo->StringAppend(nm->GetRefersTo())); | |
//Save the workbook in xlsx format | |
wb->Save(outputCreateNamedRange, SaveFormat_Xlsx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleCreatingSubtotals = dirPath + u"sampleCreatingSubtotals.xlsx"; | |
//Path of output excel file | |
U16String outputCreatingSubtotals = outPath + u"outputCreatingSubtotals.xlsx"; | |
//Load sample excel file into a workbook object | |
Workbook wb(sampleCreatingSubtotals); | |
//Get first worksheet of the workbook | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Get the cells collection of the worksheet | |
Cells cells = ws.GetCells(); | |
//Create cell area covering the cell range B3:C19 | |
CellArea ca = CellArea::CreateCellArea(u"B3", u"C19"); | |
//Create integer array of size 1 and set its first value to 1 | |
int data[1]{1}; | |
Vector<int> totalList(data,1); | |
//Apply subtotal, the consolidation function is Sum and it will be applied to second column | |
cells.Subtotal(ca, 0, ConsolidationFunction::Sum, totalList); | |
//Save the workbook in xlsx format | |
wb.Save(outputCreatingSubtotals); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleCreatingSubtotals = dirPath->StringAppend(new String("sampleCreatingSubtotals.xlsx")); | |
//Path of output excel file | |
StringPtr outputCreatingSubtotals = outPath->StringAppend(new String("outputCreatingSubtotals.xlsx")); | |
//Load sample excel file into a workbook object | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleCreatingSubtotals); | |
//Get first worksheet of the workbook | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Get the cells collection of the worksheet | |
intrusive_ptr<ICells> cells = ws->GetICells(); | |
//Create cell area covering the cell range B3:C19 | |
intrusive_ptr<ICellArea> ca = ICellArea::CreateICellArea(new String("B3"), new String("C19")); | |
//Create integer array of size 1 and set its first value to 1 | |
intrusive_ptr<Array1D<int>> totalList = new Array1D<int>(1); | |
totalList->SetValue(1, 0); | |
//Apply subtotal, the consolidation function is Sum and it will be applied to second column | |
cells->Subtotal(ca, 0, ConsolidationFunction_Sum, totalList); | |
//Save the workbook in xlsx format | |
wb->Save(outputCreatingSubtotals); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleFindOrSearchData = testPath + u"sampleFindOrSearchData.xlsx"; | |
//Load sample excel file into a workbook object | |
Workbook wb(sampleFindOrSearchData); | |
//Get first worksheet of the workbook | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
Enumerator<Cell> enCell = ws.GetCells().GetEnumerator(); | |
while (enCell.MoveNext()) | |
{ | |
Cell cell = enCell.GetCurrent(); | |
U16String fmlVal = cell.GetFormula(); | |
//Finding the cell containing the specified formula | |
if (!fmlVal.IsEmpty() && u"=SUM(A5:A10)" == cell.GetFormula()) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing formula =SUM(A5:A10): " << cell.GetName().ToUtf8() << std::endl; | |
} | |
//Finding the cell containing the formula that contains CHA | |
else if (!fmlVal.IsEmpty() && cell.GetFormula().IndexOf(u"CHA") > -1) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing the formula that contains CHA: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
else | |
{ | |
switch (cell.GetType()) | |
{ | |
case CellValueType::IsString: | |
{ | |
U16String strVal = cell.GetStringValue(); | |
//Finding the cell containing the specified string | |
if (!strVal.IsEmpty() && cell.GetStringValue().IndexOf("SampleData") > -1) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing specified string: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
//Finding the cell containing the string that contains "Two" | |
else if (!strVal.IsEmpty() && cell.GetStringValue().IndexOf("Two") > -1) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing the string that contains Two: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
//Finding the cell containing the string that starts with AAA | |
else if (!strVal.IsEmpty() && cell.GetStringValue().IndexOf("AAA") == 0) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing the string that starts with AAA: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
//Finding the cell containing the string that ends with BBB | |
else if (!strVal.IsEmpty() && cell.GetStringValue().IndexOf("BBB") == cell.GetStringValue().GetLength() - 3) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing the string that ends with BBB: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
} | |
break; | |
//Finding the cell containing the number 80 | |
case CellValueType::IsNumeric: | |
{ | |
if (80 == cell.GetIntValue()) | |
{ | |
//Printing the name of the cell found after searching worksheet | |
std::cout << "Name of the cell containing the number 80: " << cell.GetName().ToUtf8() << std::endl; | |
} | |
} | |
break; | |
default: | |
break; | |
} | |
} | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleFindOrSearchData = dirPath->StringAppend(new String("sampleFindOrSearchData.xlsx")); | |
//Load sample excel file into a workbook object | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleFindOrSearchData); | |
//Get first worksheet of the workbook | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Finding the cell containing the number 80 | |
intrusive_ptr<ICell> cell = ws->GetICells()->FindNumber(80, NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str1 = new String(L"Name of the cell containing the number 80: "); | |
Console::WriteLine(str1->StringAppend(cell->GetName())); | |
//Finding the cell containing the specified formula | |
cell = ws->GetICells()->FindFormula(new String("=SUM(A5:A10)"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str2 = new String(L"Name of the cell containing formula =SUM(A5:A10): "); | |
Console::WriteLine(str2->StringAppend(cell->GetName())); | |
//Finding the cell containing the formula that contains CHA | |
cell = ws->GetICells()->FindFormulaContains(new String("CHA"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str3 = new String(L"Name of the cell containing the formula that contains CHA: "); | |
Console::WriteLine(str3->StringAppend(cell->GetName())); | |
//Finding the cell containing the specified string | |
cell = ws->GetICells()->FindString(new String("SampleData"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str4 = new String(L"Name of the cell containing specified string: "); | |
Console::WriteLine(str4->StringAppend(cell->GetName())); | |
//Finding the cell containing the string that contains Two | |
cell = ws->GetICells()->FindStringContains(new String("Two"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str5 = new String(L"Name of the cell containing the string that contains Two: "); | |
Console::WriteLine(str5->StringAppend(cell->GetName())); | |
//Finding the cell containing the string that starts with AAA | |
cell = ws->GetICells()->FindStringStartsWith(new String("AAA"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str6 = new String(L"Name of the cell containing the string that starts with AAA: "); | |
Console::WriteLine(str6->StringAppend(cell->GetName())); | |
//Finding the cell containing the string that ends with BBB | |
cell = ws->GetICells()->FindStringEndsWith(new String("BBB"), NULL); | |
//Printing the name of the cell found after searching worksheet | |
StringPtr str7 = new String(L"Name of the cell containing the string that ends with BBB: "); | |
Console::WriteLine(str7->StringAppend(cell->GetName())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleManipulateNamedRangeInWorkbook = dirPath + u"sampleManipulateNamedRangeInWorkbook.xlsx"; | |
//Path of output excel file | |
U16String outputManipulateNamedRangeInWorkbook = outPath + u"outputManipulateNamedRangeInWorkbook.xlsx"; | |
//Create a workbook | |
Workbook wb(sampleManipulateNamedRangeInWorkbook); | |
//Read the named range created above from names collection | |
Name nm = wb.GetWorksheets().GetNames().Get(0); | |
//Print its FullText and RefersTo members | |
std::cout << "Full Text : " << nm.GetFullText().ToUtf8() << std::endl; | |
std::cout << "Refers To : " << nm.GetRefersTo().ToUtf8() << std::endl; | |
//Manipulate the RefersTo property of NamedRange | |
nm.SetRefersTo(u"=Sheet1!$D$5:$J$10"); | |
//Save the workbook in xlsx format | |
wb.Save(outputManipulateNamedRangeInWorkbook, SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleManipulateNamedRangeInWorkbook = dirPath->StringAppend(new String("sampleManipulateNamedRangeInWorkbook.xlsx")); | |
//Path of output excel file | |
StringPtr outputManipulateNamedRangeInWorkbook = outPath->StringAppend(new String("outputManipulateNamedRangeInWorkbook.xlsx")); | |
//Create a workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleManipulateNamedRangeInWorkbook); | |
//Read the named range created above from names collection | |
intrusive_ptr<IName> nm = wb->GetIWorksheets()->GetINames()->GetObjectByIndex(0); | |
//Print its FullText and RefersTo members | |
StringPtr fullTect = new String("Full Text : "); | |
Console::WriteLine(fullTect->StringAppend(nm->GetFullText())); | |
StringPtr referTo = new String("Refers To : "); | |
Console::WriteLine(referTo->StringAppend(nm->GetRefersTo())); | |
//Manipulate the RefersTo property of NamedRange | |
nm->SetRefersTo((intrusive_ptr<String>)new String("=Sheet1!$D$5:$J$10")); | |
//Save the workbook in xlsx format | |
wb->Save(outputManipulateNamedRangeInWorkbook, SaveFormat_Xlsx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Create a new workbook | |
Workbook wb; | |
//Get first worksheet which is created by default | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Adding a value to "A1" cell | |
Cell cell = ws.GetCells().Get(u"A1"); | |
cell.PutValue(5); | |
//Adding a value to "A2" cell | |
cell = ws.GetCells().Get(u"A2"); | |
cell.PutValue(15); | |
//Adding a value to "A3" cell | |
cell = ws.GetCells().Get(u"A3"); | |
cell.PutValue(25); | |
//Adding SUM formula to "A4" cell | |
cell = ws.GetCells().Get(u"A4"); | |
cell.SetFormula(u"=SUM(A1:A3)"); | |
//Calculating the results of formulas | |
wb.CalculateFormula(); | |
//Get the calculated value of the cell "A4" and print it on console | |
cell = ws.GetCells().Get(u"A4"); | |
std::cout << "Calculated Value of Cell A4: " << cell.GetStringValue().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Create a new workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Adding a value to "A1" cell | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
cell->PutValue(5); | |
//Adding a value to "A2" cell | |
cell = ws->GetICells()->GetObjectByIndex(new String("A2")); | |
cell->PutValue(15); | |
//Adding a value to "A3" cell | |
cell = ws->GetICells()->GetObjectByIndex(new String("A3")); | |
cell->PutValue(25); | |
//Adding SUM formula to "A4" cell | |
cell = ws->GetICells()->GetObjectByIndex(new String("A4")); | |
cell->SetFormula(new String("=SUM(A1:A3)")); | |
//Calculating the results of formulas | |
wb->CalculateFormula(); | |
//Get the calculated value of the cell "A4" and print it on console | |
cell = ws->GetICells()->GetObjectByIndex(new String("A4")); | |
StringPtr sCalcuInfo = new String(L"Calculated Value of Cell A4: "); | |
Console::WriteLine(sCalcuInfo->StringAppend(cell->GetStringValue())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Implement AbstractCalculationEngine interface | |
class CustomFunction1 : public AbstractCalculationEngine | |
{ | |
public: | |
void Calculate(CalculationData& data) | |
{ | |
Object funcName = data.GetParamValue(0); | |
U16String cellName = data.GetCell().GetName(); | |
Object cellValue = data.GetParamValue(1); | |
if (data.GetFunctionName() == u"MySampleFunc") | |
{ | |
std::cout << funcName.ToString().ToUtf8() << " called successfully." << std::endl; | |
data.GetCell().PutValue(cellValue); | |
} | |
if (data.GetFunctionName() == u"YourSampleFunc") | |
{ | |
std::cout << funcName.ToString().ToUtf8() << " called successfully." << std::endl; | |
data.GetCell().PutValue(cellValue); | |
} | |
} | |
}; | |
//Create workbook | |
Workbook wb; | |
//Access first worksheet in the workbook | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Adding custom formulas to Cell A1 and A2 | |
ws.GetCells().Get(u"A1").SetFormula(u"=MySampleFunc(\"MySampleFunc-Test\",1)"); | |
ws.GetCells().Get(u"A2").SetFormula(u"=YourSampleFunc(\"YourSampleFunc-Test\",2)"); | |
// Calcualting Formulas | |
CustomFunction1 custFunc; | |
CalculationOptions options; | |
options.SetCustomEngine(&custFunc); | |
wb.CalculateFormula(options); | |
//Print the value of cell A1 and A2 after the calculation of custom function implemented by us. | |
U16String valA1 = ws.GetCells().Get(u"A1").GetStringValue(); | |
U16String valA2 = ws.GetCells().Get(u"A2").GetStringValue(); | |
std::cout << "Value of A1 is : " << valA1.ToUtf8() << std::endl; | |
std::cout << "Value of A2 is : " << valA2.ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Implement AbstractCalculationEngine interface | |
class CustomFunction2 : public AbstractCalculationEngine | |
{ | |
public: | |
int stage = 0; | |
public: | |
void Calculate(CalculationData& data) | |
{ | |
if (stage == 0) | |
{ | |
data.SetCalculatedValue(0); | |
return; | |
} | |
U16String s = data.GetFunctionName(); | |
if (u"crow" == s) | |
{ | |
data.SetCalculatedValue(data.GetParamValue(0)); | |
} | |
else if (u"crow2" == s) | |
{ | |
data.SetCalculatedValue(data.GetCellRow() + 1); | |
} | |
} | |
}; | |
//Create workbook | |
Workbook wb(u"sample-file.xlsx"); | |
Cells cells = wb.GetWorksheets().Get(0).GetCells(); | |
Cells cells2 = wb.GetWorksheets().Get(1).GetCells(); | |
U16String expectedValue = u"2"; | |
if (expectedValue != cells.Get(u"B2").GetStringValue()) | |
{ | |
std::cout << "Start test: The value of cell B2 is not 2." << std::endl; | |
} | |
cells.Get(u"A2").PutValue(2); | |
cells.Get(u"A3").PutValue(3); | |
// Calcualting Formulas | |
CustomFunction2* resolver1 = new CustomFunction2(); | |
resolver1->stage = 0; | |
CalculationOptions opt1; | |
opt1.SetCustomEngine(resolver1); | |
wb.CalculateFormula(opt1); | |
cells2.InsertRows(1, 9, true); | |
Range range = cells2.CreateRange(1, 0, 9, cells2.GetMaxColumn() + 1); | |
Range source = cells2.CreateRange(0, 0, 1, cells2.GetMaxColumn() + 1); | |
PasteOptions options; | |
options.SetPasteType(PasteType::All); | |
range.Copy(source, options); | |
// Calcualting Formulas | |
CustomFunction2* resolver2 = new CustomFunction2(); | |
resolver2->stage = 1; | |
CalculationOptions opt2; | |
opt2.SetCustomEngine(resolver2); | |
wb.CalculateFormula(opt2); | |
if (expectedValue == cells.Get(u"B2").GetStringValue()) | |
{ | |
std::cout << "End test: The value of cell B2 is 2." << std::endl; | |
} | |
delete resolver1; | |
delete resolver2; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Implement ICustomFunction interface | |
class CustomFunction : public ICustomFunction | |
{ | |
public: | |
//Evalaute and return the values of your custom functions | |
intrusive_ptr<Aspose::Cells::System::Object> | |
CalculateCustomFunction( | |
intrusive_ptr<Aspose::Cells::System::String> functionName, | |
intrusive_ptr<Aspose::Cells::System::Collections::ArrayList> paramsList, | |
intrusive_ptr<Aspose::Cells::System::Collections::ArrayList> contextObjects) | |
{ | |
if (functionName->Equals(new String("MySampleFunc"))) | |
{ | |
return new String("MY sample function was called successfully."); | |
} | |
if (functionName->Equals(new String("YourSampleFunc"))) | |
{ | |
return new String("YOUR sample function was called successfully."); | |
} | |
return NULL; | |
} | |
}; | |
//Using ICustomFunction Feature | |
void UsingICustomFunctionFeature() | |
{ | |
//Create workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet in the workbook | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Adding custom formulas to Cell A1 and A2 | |
ws->GetICells()->GetObjectByIndex(new String("A1"))->SetFormula(new String("=MySampleFunc()")); | |
ws->GetICells()->GetObjectByIndex(new String("A2"))->SetFormula(new String("=YourSampleFunc()")); | |
// Calcualting Formulas | |
intrusive_ptr<CustomFunction> custFunc = new CustomFunction(); | |
wb->CalculateFormula(false, custFunc); | |
//Print the value of cell A1 and A2 after the calculation of custom function implemented by us. | |
intrusive_ptr<String> valA1 = ws->GetICells()->GetObjectByIndex(new String("A1"))->GetStringValue(); | |
intrusive_ptr<String> valA2 = ws->GetICells()->GetObjectByIndex(new String("A2"))->GetStringValue(); | |
//Print the values on console | |
StringPtr str1 = new String("Value of A1: "); | |
Console::WriteLine(str1->StringAppend(valA1)); | |
StringPtr str2 = new String("Value of A2: "); | |
Console::WriteLine(str2->StringAppend(valA2)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of output excel file | |
U16String outputAddingFormulasAndCalculatingResults = outPath + u"outputAddingFormulasAndCalculatingResults.xlsx"; | |
//Create workbook | |
Workbook wb; | |
//Access first worksheet in the workbook | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Adding integer values to cells A1, A2 and A3 | |
ws.GetCells().Get(u"A1").PutValue(10); | |
ws.GetCells().Get(u"A2").PutValue(20); | |
ws.GetCells().Get(u"A3").PutValue(70); | |
//Adding a SUM formula to "A4" cell | |
ws.GetCells().Get(u"A4").SetFormula(u"=SUM(A1:A3)"); | |
//Calculating the results of formulas | |
wb.CalculateFormula(); | |
//Get the calculated value of the cell | |
U16String strVal = ws.GetCells().Get(u"A4").GetStringValue(); | |
//Print the calculated value on console | |
std::cout << "Calculated Result: " << strVal.ToUtf8() <<std::endl; | |
//Saving the workbook | |
wb.Save(outputAddingFormulasAndCalculatingResults); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of output excel file | |
StringPtr outputAddingFormulasAndCalculatingResults = outPath->StringAppend(new String("outputAddingFormulasAndCalculatingResults.xlsx")); | |
//Create workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet in the workbook | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Adding integer values to cells A1, A2 and A3 | |
ws->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(10); | |
ws->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(20); | |
ws->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(70); | |
//Adding a SUM formula to "A4" cell | |
ws->GetICells()->GetObjectByIndex(new String("A4"))->SetFormula(new String("=SUM(A1:A3)")); | |
//Calculating the results of formulas | |
wb->CalculateFormula(); | |
//Get the calculated value of the cell | |
intrusive_ptr<String> strVal = ws->GetICells()->GetObjectByIndex(new String("A4"))->GetStringValue(); | |
//Print the calculated value on console | |
StringPtr str1 = new String("Calculated Result: "); | |
Console::WriteLine(str1->StringAppend(strVal)); | |
//Saving the workbook | |
wb->Save(outputAddingFormulasAndCalculatingResults); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\Formulas\\"); | |
//Path of input excel file | |
U16String sampleCalculatingFormulasOnceOnly = dirPath + u"sampleCalculatingFormulasOnceOnly.xlsx"; | |
//Create workbook | |
Workbook wb(sampleCalculatingFormulasOnceOnly); | |
//Set the CreateCalcChain as false | |
wb.GetSettings().GetFormulaSettings().SetEnableCalculationChain(false); | |
//Get the time before formula calculationint | |
auto startTime = std::chrono::system_clock::now(); | |
//Calculate the workbook formulas | |
wb.CalculateFormula(); | |
//Get the time after formula calculation | |
auto interval = std::chrono::system_clock::now() - startTime; | |
long long time = std::chrono::duration_cast<std::chrono::milliseconds>(interval).count(); | |
std::cout << "Workbook Formula Calculation Elapsed Time in Milliseconds: " << time << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\Formulas\\"); | |
//Path of input excel file | |
StringPtr sampleCalculatingFormulasOnceOnly = dirPath->StringAppend(new String("sampleCalculatingFormulasOnceOnly.xlsx")); | |
//Create workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleCalculatingFormulasOnceOnly); | |
//Set the CreateCalcChain as false | |
wb->GetISettings()->SetCreateCalcChain(false); | |
//Get the time in milliseconds before formula calculation | |
int before_miliseconds = Aspose::Cells::System::DateTime::GetNow()->GetMillisecond(); | |
//Calculate the workbook formulas | |
wb->CalculateFormula(); | |
//Get the time in milliseconds after formula calculation | |
int after_miliseconds = Aspose::Cells::System::DateTime::GetNow()->GetMillisecond(); | |
//Print the difference in milliseconds | |
StringPtr str1 = new String("Workbook Formula Calculation Elapsed Time in Milliseconds: "); | |
Console::WriteLine(str1->StringAppend(Int32Helper::ToString(after_miliseconds - before_miliseconds))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Create workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet in the workbook | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Put 20 in cell A1 | |
intrusive_ptr<ICell> cellA1 = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
cellA1->PutValue(20); | |
//Put 30 in cell A2 | |
intrusive_ptr<ICell> cellA2 = ws->GetICells()->GetObjectByIndex(new String("A2")); | |
cellA2->PutValue(30); | |
//Calculate the Sum of A1 and A2 | |
intrusive_ptr<Aspose::Cells::System::Object> results = ws->CalculateFormula(new String("=Sum(A1:A2)")); | |
//Print the output | |
StringPtr str1 = new String("Value of A1: "); | |
Console::WriteLine(str1->StringAppend(cellA1->GetStringValue())); | |
StringPtr str2 = new String("Value of A2: "); | |
Console::WriteLine(str2->StringAppend(cellA2->GetStringValue())); | |
StringPtr str3 = new String("Result of Sum(A1:A2): "); | |
Console::WriteLine(str3->StringAppend(results->ToString())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Paths of source and output excel files | |
U16String samplePath(dirPath + u"sampleManagingDocumentProperties.xlsx"); | |
U16String outputPath(outPath + u"outputManagingDocumentProperties.xlsx"); | |
//Load the sample excel file | |
Workbook wb(samplePath); | |
//Read built-in title and subject properties | |
U16String strTitle = wb.GetBuiltInDocumentProperties().GetTitle(); | |
U16String strSubject = wb.GetBuiltInDocumentProperties().GetSubject(); | |
U16String title(u"Title: "); | |
std::cout << title.ToUtf8() << strTitle.ToUtf8() << std::endl; | |
U16String subject(u"Subject: "); | |
std::cout << subject.ToUtf8()<<strSubject.ToUtf8() << std::endl; | |
//Modify built-in title and subject properties | |
strTitle = u"Aspose.Cells New Title"; | |
strSubject = u"Aspose.Cells New Subject"; | |
wb.GetBuiltInDocumentProperties().SetTitle(strTitle); | |
wb.GetBuiltInDocumentProperties().SetSubject(strSubject); | |
//Read the custom property | |
U16String strCustomPropName(u"MyCustom1"); | |
U16String strCustomPropValue = wb.GetCustomDocumentProperties().Get(strCustomPropName).ToString(); | |
U16String myCustom1(u"\r\nMyCustom1: "); | |
std::cout << myCustom1.ToUtf8()<<strCustomPropValue.ToUtf8() << std::endl; | |
//Add a new custom property | |
strCustomPropName = u"MyCustom5"; | |
strCustomPropValue = u"This is my custom five."; | |
wb.GetCustomDocumentProperties().Add(strCustomPropName, strCustomPropValue); | |
//Save the output excel file | |
wb.Save(outputPath); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Paths of source and output excel files | |
StringPtr samplePath = dirPath->StringAppend(new String(L"sampleManagingDocumentProperties.xlsx")); | |
StringPtr outputPath = outPath->StringAppend(new String(L"outputManagingDocumentProperties.xlsx")); | |
//Load the sample excel file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(samplePath); | |
//Read built-in title and subject properties | |
StringPtr strTitle = wb->GetIBuiltInDocumentProperties()->GetTitle(); | |
StringPtr strSubject = wb->GetIBuiltInDocumentProperties()->GetSubject(); | |
StringPtr title = new String("Title: "); | |
Console::WriteLine(title->StringAppend(strTitle)); | |
StringPtr subject = new String("Subject: "); | |
Console::WriteLine(subject->StringAppend(strSubject)); | |
//Modify built-in title and subject properties | |
strTitle = new String("Aspose.Cells New Title"); | |
strSubject = new String("Aspose.Cells New Subject"); | |
wb->GetIBuiltInDocumentProperties()->SetTitle(strTitle); | |
wb->GetIBuiltInDocumentProperties()->SetSubject(strSubject); | |
//Read the custom property | |
StringPtr strCustomPropName = new String("MyCustom1"); | |
StringPtr strCustomPropValue = wb->GetICustomDocumentProperties()->GetObjectByIndex(strCustomPropName)->ToString(); | |
StringPtr myCustom1 = new String("\r\nMyCustom1: "); | |
Console::WriteLine(myCustom1->StringAppend(strCustomPropValue)); | |
//Add a new custom property | |
strCustomPropName = new String("MyCustom5"); | |
strCustomPropValue = new String("This is my custom five."); | |
wb->GetICustomDocumentProperties()->AddIDocumentProperty(strCustomPropName, strCustomPropValue); | |
//Save the output excel file | |
wb->Save(outputPath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Create Workbook object from an Excel file path | |
Workbook workbook(dirPath + u"sampleExcelFile.xlsx"); | |
//Show following message on console | |
std::cout << "Workbook opened successfully using file path." << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Create Workbook object from an Excel file path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(dirPath->StringAppend(new String("sampleExcelFile.xlsx"))); | |
//Show following message on console | |
Console::WriteLine(new String("Workbook opened successfully using file path.")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//You need to write your own code to read the contents of the sampleExcelFile.xlsx file into this variable. | |
Vector<uint8_t> FileStream{ 0 }; //"sampleExcelFile.xlsx" | |
//Create Workbook object from a Stream object | |
Workbook workbook(FileStream); | |
//Show following message on console | |
std::cout << "Workbook opened successfully using stream." << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Create a Stream object | |
intrusive_ptr<FileStream> fstream = new FileStream(dirPath->StringAppend(new String("sampleExcelFile.xlsx")), FileMode_Open); | |
//Create Workbook object from a Stream object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(fstream); | |
//Show following message on console | |
Console::WriteLine(new String("Workbook opened successfully using stream.")); | |
//Close the Stream object | |
fstream->Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input csv file | |
U16String srcReadWriteCSV = dirPath + u"srcReadWriteCSV.csv"; | |
//Path of output csv file | |
U16String outReadWriteCSV = outPath + u"outReadWriteCSV.csv"; | |
//Read source csv file | |
Workbook wb(srcReadWriteCSV); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Access cell A1 | |
Cell cell = ws.GetCells().Get(u"A1"); | |
//Get the string value of cell A1 | |
U16String strVal = cell.GetStringValue(); | |
//Print the string value of cell A1 | |
U16String cellValue(u"Cell Value: "); | |
std::cout << cellValue.ToUtf8() << strVal.ToUtf8() << std::endl; | |
//Access cell C4 | |
cell = ws.GetCells().Get(u"C4"); | |
//Put the string value of cell A1 into C4 | |
U16String strValPtr(strVal); | |
cell.PutValue(strValPtr); | |
//Save the workbook in csv format | |
wb.Save(outReadWriteCSV, SaveFormat::CSV); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input csv file | |
StringPtr srcReadWriteCSV = dirPath->StringAppend(new String(L"srcReadWriteCSV.csv")); | |
//Path of output csv file | |
StringPtr outReadWriteCSV = outPath->StringAppend(new String(L"outReadWriteCSV.csv")); | |
//Read source csv file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(srcReadWriteCSV); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell A1 | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
//Get the string value of cell A1 | |
StringPtr strVal = cell->GetStringValue(); | |
//Print the string value of cell A1 | |
StringPtr cellValue = new String("Cell Value: "); | |
Console::WriteLine(cellValue->StringAppend(strVal)); | |
//Access cell C4 | |
cell = ws->GetICells()->GetObjectByIndex(new String("C4")); | |
//Put the string value of cell A1 into C4 | |
intrusive_ptr<String> strValPtr = new String(strVal); | |
cell->PutValue(strValPtr); | |
//Save the workbook in csv format | |
wb->Save(outReadWriteCSV, SaveFormat_CSV); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input tab delimited file | |
U16String srcReadWriteTabDelimited = dirPath + u"srcReadWriteTabDelimited.txt"; | |
//Path of output tab delimited file | |
U16String outReadWriteTabDelimited = outPath + u"outReadWriteTabDelimited.txt"; | |
//Read source tab delimited file | |
Workbook wb(srcReadWriteTabDelimited); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Access cell A1 | |
Cell cell = ws.GetCells().Get(u"A1"); | |
//Get the string value of cell A1 | |
U16String strVal = cell.GetStringValue(); | |
//Print the string value of cell A1 | |
U16String cellValue(u"Cell Value: "); | |
std::cout << cellValue.ToUtf8() << strVal.ToUtf8() << std::endl; | |
//Access cell C4 | |
cell = ws.GetCells().Get(u"C4"); | |
//Put the string value of cell A1 into C4 | |
U16String strValPtr(strVal); | |
cell.PutValue(strValPtr); | |
//Save the workbook in tab delimited format | |
wb.Save(outReadWriteTabDelimited, SaveFormat::TabDelimited); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input tab delimited file | |
StringPtr srcReadWriteTabDelimited = dirPath->StringAppend(new String(L"srcReadWriteTabDelimited.txt")); | |
//Path of output tab delimited file | |
StringPtr outReadWriteTabDelimited = outPath->StringAppend(new String(L"outReadWriteTabDelimited.txt")); | |
//Read source tab delimited file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(srcReadWriteTabDelimited); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell A1 | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
//Get the string value of cell A1 | |
StringPtr strVal = cell->GetStringValue(); | |
//Print the string value of cell A1 | |
StringPtr cellValue = new String("Cell Value: "); | |
Console::WriteLine(cellValue->StringAppend(strVal)); | |
//Access cell C4 | |
cell = ws->GetICells()->GetObjectByIndex(new String("C4")); | |
//Put the string value of cell A1 into C4 | |
intrusive_ptr<String> strValPtr = new String(strVal); | |
cell->PutValue(strValPtr); | |
//Save the workbook in tab delimited format | |
wb->Save(outReadWriteTabDelimited, SaveFormat_TabDelimited); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input excel file | |
U16String srcReadWriteXLSB = dirPath + u"srcReadWriteXLSB.xlsb"; | |
//Path of output excel file | |
U16String outReadWriteXLSB = outPath + u"outReadWriteXLSB.xlsb"; | |
//Read source xlsb file | |
Workbook wb(srcReadWriteXLSB); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Access cell A1 | |
Cell cell = ws.GetCells().Get(u"A1"); | |
//Get the string value of cell A1 | |
U16String strVal = cell.GetStringValue(); | |
//Print the string value of cell A1 | |
U16String cellValue(u"Cell Value: "); | |
std::cout << cellValue.ToUtf8() << strVal.ToUtf8() << std::endl; | |
//Access cell C4 | |
cell = ws.GetCells().Get(u"C4"); | |
//Put the string value of cell A1 into C4 | |
U16String strValPtr(strVal); | |
cell.PutValue(strValPtr); | |
//Save the workbook in XLSB format | |
wb.Save(outReadWriteXLSB, SaveFormat::Xlsb); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input excel file | |
StringPtr srcReadWriteXLSB = dirPath->StringAppend(new String("srcReadWriteXLSB.xlsb")); | |
//Path of output excel file | |
StringPtr outReadWriteXLSB = outPath->StringAppend(new String("outReadWriteXLSB.xlsb")); | |
//Read source xlsb file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(srcReadWriteXLSB); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell A1 | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
//Get the string value of cell A1 | |
StringPtr strVal = cell->GetStringValue(); | |
//Print the string value of cell A1 | |
StringPtr cellValue = new String("Cell Value: "); | |
Console::WriteLine(cellValue->StringAppend(strVal)); | |
//Access cell C4 | |
cell = ws->GetICells()->GetObjectByIndex(new String("C4")); | |
//Put the string value of cell A1 into C4 | |
intrusive_ptr<String> strValPtr = new String(strVal); | |
cell->PutValue(strValPtr); | |
//Save the workbook in XLSB format | |
wb->Save(outReadWriteXLSB, SaveFormat_Xlsb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input excel file | |
U16String srcReadWriteXLSM = dirPath + u"srcReadWriteXLSM.xlsm"; | |
//Path of output excel file | |
U16String outReadWriteXLSM = outPath + u"outReadWriteXLSM.xlsm"; | |
//Read source xlsm file | |
Workbook wb(srcReadWriteXLSM); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Access cell A1 | |
Cell cell = ws.GetCells().Get(u"A1"); | |
//Get the string value of cell A1 | |
U16String strVal = cell.GetStringValue(); | |
//Print the string value of cell A1 | |
U16String cellValue(u"Cell Value: "); | |
std::cout<<cellValue.ToUtf8() << strVal.ToUtf8() << std::endl; | |
//Access cell C4 | |
cell = ws.GetCells().Get(u"C4"); | |
//Put the string value of cell A1 into C4 | |
U16String strValPtr(strVal); | |
cell.PutValue(strValPtr); | |
//Save the workbook in XLSM format | |
wb.Save(outReadWriteXLSM, SaveFormat::Xlsm); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input excel file | |
StringPtr srcReadWriteXLSM = dirPath->StringAppend(new String("srcReadWriteXLSM.xlsm")); | |
//Path of output excel file | |
StringPtr outReadWriteXLSM = outPath->StringAppend(new String("outReadWriteXLSM.xlsm")); | |
//Read source xlsm file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(srcReadWriteXLSM); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Access cell A1 | |
intrusive_ptr<ICell> cell = ws->GetICells()->GetObjectByIndex(new String("A1")); | |
//Get the string value of cell A1 | |
StringPtr strVal = cell->GetStringValue(); | |
//Print the string value of cell A1 | |
StringPtr cellValue = new String("Cell Value: "); | |
Console::WriteLine(cellValue->StringAppend(strVal)); | |
//Access cell C4 | |
cell = ws->GetICells()->GetObjectByIndex(new String("C4")); | |
//Put the string value of cell A1 into C4 | |
intrusive_ptr<String> strValPtr = new String(strVal); | |
cell->PutValue(strValPtr); | |
//Save the workbook in XLSM format | |
wb->Save(outReadWriteXLSM, SaveFormat_Xlsm); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//load/creat the Excel file | |
Workbook wb; | |
//Set cell value | |
wb.GetWorksheets().Get(0).GetCells().Get(u"A1").PutValue(u"test"); | |
//Set security options using PdfSecurityOptions class | |
PdfSecurityOptions securityOptions; | |
securityOptions.SetOwnerPassword(u"123"); | |
securityOptions.SetPrintPermission(true); | |
securityOptions.SetAccessibilityExtractContent(true); | |
//Set saving PDF parameters | |
PdfSaveOptions pdfSaveOptions; | |
pdfSaveOptions.SetSecurityOptions(securityOptions); | |
//Save encrypted PDF files | |
wb.Save("security.pdf", pdfSaveOptions); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Load sample Excel file | |
Workbook workbook(dirPath + u"sampleExcelFile.xlsx"); | |
//Save in Excel 97-2003 format | |
workbook.Save(outPath + u"outputSavingFiletoSomeLocationExcel97-2003.xls"); | |
//OR | |
workbook.Save(outPath + u"outputSavingFiletoSomeLocationOrExcel97-2003.xls", SaveFormat::Excel97To2003); | |
//Save in Excel2007 xlsx format | |
workbook.Save(outPath + u"outputSavingFiletoSomeLocationXlsx.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Load sample Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(dirPath->StringAppend(new String("sampleExcelFile.xlsx"))); | |
//Save in Excel 97-2003 format | |
workbook->Save(outPath->StringAppend(new String("outputSavingFiletoSomeLocationExcel97-2003.xls"))); | |
//OR | |
workbook->Save(outPath->StringAppend(new String("outputSavingFiletoSomeLocationOrExcel97-2003.xls")), SaveFormat_Excel97To2003); | |
//Save in Excel2007 xlsx format | |
workbook->Save(outPath->StringAppend(new String("outputSavingFiletoSomeLocationXlsx.xlsx")), SaveFormat_Xlsx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u""); | |
//Output directory path | |
U16String outPath(u""); | |
//Load sample Excel file | |
Workbook workbook(dirPath + u"wdd.xlsx"); | |
//Create FileStream object | |
std::ofstream fileStream(outPath.ToUtf8() + "wdd2.xlsx", std::ios::binary); | |
//Save the Workbook to Stream | |
Vector<uint8_t> stream = workbook.Save(SaveFormat::Xlsx); | |
fileStream.write(reinterpret_cast<char*>(stream.GetData()), stream.GetLength()); | |
fileStream.close(); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\LoadingSavingAndConverting\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Load sample Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(dirPath->StringAppend(new String("sampleExcelFile.xlsx"))); | |
//Create FileStream object | |
intrusive_ptr<FileStream> stream = new FileStream(outPath->StringAppend(new String("outputSavingFiletoStream.xlsx")), FileMode_CreateNew); | |
//Save the Workbook to Stream | |
workbook->Save(stream, SaveFormat_Xlsx); | |
stream->Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of output excel file | |
U16String outputCreatePivotTable = outPath + u"outputCreatePivotTable.xlsx"; | |
//Load the sample excel file | |
Workbook wb; | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Add source data for pivot table | |
U16String str(u"Fruit"); | |
ws.GetCells().Get(u"A1").PutValue(str); | |
str = u"Quantity"; | |
ws.GetCells().Get(u"B1").PutValue(str); | |
str = u"Price"; | |
ws.GetCells().Get(u"C1").PutValue(str); | |
str = u"Apple"; | |
ws.GetCells().Get(u"A2").PutValue(str); | |
str = u"Orange"; | |
ws.GetCells().Get(u"A3").PutValue(str); | |
ws.GetCells().Get(u"B2").PutValue(3); | |
ws.GetCells().Get(u"B3").PutValue(4); | |
ws.GetCells().Get(u"C2").PutValue(2); | |
ws.GetCells().Get(u"C3").PutValue(1); | |
//Add pivot table | |
int idx = ws.GetPivotTables().Add(u"A1:C3", u"E5", u"MyPivotTable"); | |
//Access created pivot table | |
PivotTable pt = ws.GetPivotTables().Get(idx); | |
//Manipulate pivot table rows, columns and data fields | |
pt.AddFieldToArea(PivotFieldType::Row, pt.GetBaseFields().Get(0)); | |
pt.AddFieldToArea(PivotFieldType::Data, pt.GetBaseFields().Get(1)); | |
pt.AddFieldToArea(PivotFieldType::Data, pt.GetBaseFields().Get(2)); | |
pt.AddFieldToArea(PivotFieldType::Column, pt.GetDataField()); | |
//Set pivot table style | |
pt.SetPivotTableStyleType(PivotTableStyleType::PivotTableStyleMedium9); | |
//Save the output excel file | |
wb.Save(outputCreatePivotTable); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of output excel file | |
StringPtr outputCreatePivotTable = outPath->StringAppend(new String("outputCreatePivotTable.xlsx")); | |
//Load the sample excel file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Add source data for pivot table | |
intrusive_ptr<String> str = new String("Fruit"); | |
ws->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(str); | |
str = new String("Quantity"); | |
ws->GetICells()->GetObjectByIndex(new String("B1"))->PutValue(str); | |
str = new String("Price"); | |
ws->GetICells()->GetObjectByIndex(new String("C1"))->PutValue(str); | |
str = new String("Apple"); | |
ws->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(str); | |
str = new String("Orange"); | |
ws->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(str); | |
ws->GetICells()->GetObjectByIndex(new String("B2"))->PutValue(3); | |
ws->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(4); | |
ws->GetICells()->GetObjectByIndex(new String("C2"))->PutValue(2); | |
ws->GetICells()->GetObjectByIndex(new String("C3"))->PutValue(1); | |
//Add pivot table | |
int idx = ws->GetIPivotTables()->Add(new String("A1:C3"), new String("E5"), new String("MyPivotTable")); | |
//Access created pivot table | |
intrusive_ptr<IPivotTable> pt = ws->GetIPivotTables()->GetObjectByIndex(idx); | |
//Manipulate pivot table rows, columns and data fields | |
pt->AddFieldToArea(PivotFieldType_Row, pt->GetIBaseFields()->GetObjectByIndex(0)); | |
pt->AddFieldToArea(PivotFieldType_Data, pt->GetIBaseFields()->GetObjectByIndex(1)); | |
pt->AddFieldToArea(PivotFieldType_Data, pt->GetIBaseFields()->GetObjectByIndex(2)); | |
pt->AddFieldToArea(PivotFieldType_Column, pt->GetIDataField()); | |
//Set pivot table style | |
pt->SetPivotTableStyleType(PivotTableStyleType_PivotTableStyleMedium9); | |
//Save the output excel file | |
wb->Save(outputCreatePivotTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\PivotTables\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input excel file | |
U16String sampleManipulatePivotTable = dirPath + u"sampleManipulatePivotTable.xlsx"; | |
//Path of output excel file | |
U16String outputManipulatePivotTable = outPath + u"outputManipulatePivotTable.xlsx"; | |
//Load the sample excel file | |
Workbook wb(sampleManipulatePivotTable); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Change value of cell B3 which is inside the source data of pivot table | |
ws.GetCells().Get(u"B3").PutValue(u"Cup"); | |
//Get the value of cell H8 before refreshing pivot table | |
U16String val = ws.GetCells().Get(u"H8").GetStringValue(); | |
std::cout << "Before refreshing Pivot Table value of cell H8: " << val.ToUtf8() << std::endl; | |
//Access pivot table, refresh and calculate it | |
PivotTable pt = ws.GetPivotTables().Get(0); | |
pt.RefreshData(); | |
pt.CalculateData(); | |
//Get the value of cell H8 after refreshing pivot table | |
val = ws.GetCells().Get(u"H8").GetStringValue(); | |
std::cout << "After refreshing Pivot Table value of cell H8: " << val.ToUtf8() << std::endl; | |
//Save the output excel file | |
wb.Save(outputManipulatePivotTable); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\PivotTables\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input excel file | |
StringPtr sampleManipulatePivotTable = dirPath->StringAppend(new String("sampleManipulatePivotTable.xlsx")); | |
//Path of output excel file | |
StringPtr outputManipulatePivotTable = outPath->StringAppend(new String("outputManipulatePivotTable.xlsx")); | |
//Load the sample excel file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleManipulatePivotTable); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Change value of cell B3 which is inside the source data of pivot table | |
intrusive_ptr<String> str = new String("Cup"); | |
ws->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(str); | |
//Get the value of cell H8 before refreshing pivot table | |
intrusive_ptr<String> val = ws->GetICells()->GetObjectByIndex(new String("H8"))->GetStringValue(); | |
StringPtr str1 = new String(L"Before refreshing Pivot Table value of cell H8: "); | |
Console::WriteLine(str1->StringAppend(val)); | |
//Access pivot table, refresh and calculate it | |
intrusive_ptr<IPivotTable> pt = ws->GetIPivotTables()->GetObjectByIndex(0); | |
pt->RefreshData(); | |
pt->CalculateData(); | |
//Get the value of cell H8 after refreshing pivot table | |
val = ws->GetICells()->GetObjectByIndex(new String("H8"))->GetStringValue(); | |
StringPtr str2 = new String(L"After refreshing Pivot Table value of cell H8: "); | |
Console::WriteLine(str2->StringAppend(val)); | |
//Save the output excel file | |
wb->Save(outputManipulatePivotTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Setting the height of all rows in the worksheet to 25 | |
worksheet.GetCells().SetStandardHeight(25); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleRowsAndColumns = dirPath->StringAppend(new String("sampleRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputRowsAndColumns = outPath->StringAppend(new String("outputRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Setting the height of all rows in the worksheet to 25 | |
worksheet->GetICells()->SetStandardHeight(25); | |
//Save the Excel file. | |
workbook->Save(outputRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the height of the second row to 35 | |
worksheet.GetCells().SetRowHeight(1, 35); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleRowsAndColumns = dirPath->StringAppend(new String("sampleRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputRowsAndColumns = outPath->StringAppend(new String("outputRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Setting the height of the second row to 35 | |
worksheet->GetICells()->SetRowHeight(1, 35); | |
//Save the Excel file. | |
workbook->Save(outputRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the width of all columns in the worksheet to 20.5 | |
worksheet.GetCells().SetStandardWidth(20.5); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleRowsAndColumns = dirPath->StringAppend(new String("sampleRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputRowsAndColumns = outPath->StringAppend(new String("outputRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Setting the width of all columns in the worksheet to 20.5 | |
worksheet->GetICells()->SetStandardWidth(20.5); | |
//Save the Excel file. | |
workbook->Save(outputRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleRowsAndColumns = dirPath + u"sampleRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputRowsAndColumns = outPath + u"outputRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Setting the width of the second column to 56.5 | |
worksheet.GetCells().SetColumnWidth(1, 56.5); | |
//Save the Excel file. | |
workbook.Save(outputRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleRowsAndColumns = dirPath->StringAppend(new String("sampleRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputRowsAndColumns = outPath->StringAppend(new String("outputRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Setting the width of the second column to 56.5 | |
worksheet->GetICells()->SetColumnWidth(1, 56.5); | |
//Save the Excel file. | |
workbook->Save(outputRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleCopyingRowsAndColumns = dirPath + u"sampleCopyingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputCopyingRowsAndColumns = outPath + u"outputCopyingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleCopyingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Copy the third column to eighth column | |
worksheet.GetCells().CopyColumn(worksheet.GetCells(), 2, 7); | |
//Save the Excel file. | |
workbook.Save(outputCopyingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleCopyingRowsAndColumns = dirPath->StringAppend(new String("sampleCopyingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputCopyingRowsAndColumns = outPath->StringAppend(new String("outputCopyingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleCopyingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Copy the third column to eighth column | |
worksheet->GetICells()->CopyColumn(worksheet->GetICells(), 2, 7); | |
//Save the Excel file. | |
workbook->Save(outputCopyingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleCopyingRowsAndColumns = dirPath + u"sampleCopyingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputCopyingRowsAndColumns = outPath + u"outputCopyingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleCopyingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Copy the second row with data, formattings, images and drawing objects to the 16th row in the worksheet. | |
worksheet.GetCells().CopyRow(worksheet.GetCells(), 1, 15); | |
//Save the Excel file. | |
workbook.Save(outputCopyingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleCopyingRowsAndColumns = dirPath->StringAppend(new String("sampleCopyingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputCopyingRowsAndColumns = outPath->StringAppend(new String("outputCopyingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleCopyingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Copy the second row with data, formattings, images and drawing objects to the 16th row in the worksheet. | |
worksheet->GetICells()->CopyRow(worksheet->GetICells(), 1, 15); | |
//Save the Excel file. | |
workbook->Save(outputCopyingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleGroupingUngroupingRowsAndColumns = dirPath + u"sampleGroupingUngroupingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputGroupingUngroupingRowsAndColumns = outPath + u"outputGroupingUngroupingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Grouping first seven rows and first four columns | |
worksheet.GetCells().GroupRows(0, 6, true); | |
worksheet.GetCells().GroupColumns(0, 3, true); | |
//Save the Excel file. | |
workbook.Save(outputGroupingUngroupingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleGroupingUngroupingRowsAndColumns = dirPath->StringAppend(new String("sampleGroupingUngroupingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputGroupingUngroupingRowsAndColumns = outPath->StringAppend(new String("outputGroupingUngroupingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Grouping first seven rows and first four columns | |
worksheet->GetICells()->GroupRows(0, 6, true); | |
worksheet->GetICells()->GroupColumns(0, 3, true); | |
//Save the Excel file. | |
workbook->Save(outputGroupingUngroupingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleGroupingUngroupingRowsAndColumns = dirPath + u"sampleGroupingUngroupingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputGroupingUngroupingRowsAndColumns = outPath + u"outputGroupingUngroupingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the second worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(1); | |
//UnGroup first seven rows and first four columns | |
worksheet.GetCells().UngroupRows(0, 6); | |
worksheet.GetCells().UngroupColumns(0, 3); | |
//Save the Excel file. | |
workbook.Save(outputGroupingUngroupingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleGroupingUngroupingRowsAndColumns = dirPath->StringAppend(new String("sampleGroupingUngroupingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputGroupingUngroupingRowsAndColumns = outPath->StringAppend(new String("outputGroupingUngroupingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the second worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(1); | |
//UnGroup first seven rows and first four columns | |
worksheet->GetICells()->UngroupRows(0, 6); | |
worksheet->GetICells()->UngroupColumns(0, 3); | |
//Save the Excel file. | |
workbook->Save(outputGroupingUngroupingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleInsertingDeletingRowsAndColumns = dirPath + u"sampleInsertingDeletingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputInsertingDeletingRowsAndColumns = outPath + u"outputInsertingDeletingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Deleting a column from the worksheet at 2nd position | |
worksheet.GetCells().DeleteColumn(1); | |
//Save the Excel file. | |
workbook.Save(outputInsertingDeletingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleDeleteColumn = dirPath->StringAppend(new String("sampleInsertingDeletingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputDeleteColumn = outPath->StringAppend(new String("outputInsertingDeletingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleDeleteColumn); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Deleting a column from the worksheet at 2nd position | |
worksheet->GetICells()->DeleteColumn(4); | |
//Save the Excel file. | |
workbook->Save(outputDeleteColumn); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleInsertingDeletingRowsAndColumns = dirPath + u"sampleInsertingDeletingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputInsertingDeletingRowsAndColumns = outPath + u"outputInsertingDeletingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Deleting 10 rows from the worksheet starting from 3rd row | |
worksheet.GetCells().DeleteRows(2, 10); | |
//Save the Excel file. | |
workbook.Save(outputInsertingDeletingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleInsertingDeletingRowsAndColumns = dirPath->StringAppend(new String("sampleInsertingDeletingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputInsertingDeletingRowsAndColumns = outPath->StringAppend(new String("outputInsertingDeletingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Deleting 10 rows from the worksheet starting from 3rd row | |
worksheet->GetICells()->DeleteRows(2, 10); | |
//Save the Excel file. | |
workbook->Save(outputInsertingDeletingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleInsertingDeletingRowsAndColumns = dirPath + u"sampleInsertingDeletingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputInsertingDeletingRowsAndColumns = outPath + u"outputInsertingDeletingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Inserting a column into the worksheet at 2nd position | |
worksheet.GetCells().InsertColumn(1); | |
//Save the Excel file. | |
workbook.Save(outputInsertingDeletingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleInsertingDeletingRowsAndColumns = dirPath->StringAppend(new String("sampleInsertingDeletingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputInsertingDeletingRowsAndColumns = outPath->StringAppend(new String("outputInsertingDeletingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Inserting a column into the worksheet at 2nd position | |
worksheet->GetICells()->InsertColumn(1); | |
//Save the Excel file. | |
workbook->Save(outputInsertingDeletingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleInsertingDeletingRowsAndColumns = dirPath + u"sampleInsertingDeletingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputInsertingDeletingRowsAndColumns = outPath + u"outputInsertingDeletingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Inserting 10 rows into the worksheet starting from 3rd row | |
worksheet.GetCells().InsertRows(2, 10); | |
//Save the Excel file. | |
workbook.Save(outputInsertingDeletingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleInsertingDeletingRowsAndColumns = dirPath->StringAppend(new String("sampleInsertingDeletingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputInsertingDeletingRowsAndColumns = outPath->StringAppend(new String("outputInsertingDeletingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Inserting 10 rows into the worksheet starting from 3rd row | |
worksheet->GetICells()->InsertRows(2, 10); | |
//Save the Excel file. | |
workbook->Save(outputInsertingDeletingRowsAndColumns); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of input excel file | |
U16String sampleInsertingDeletingRowsAndColumns = dirPath + u"sampleInsertingDeletingRowsAndColumns.xlsx"; | |
//Path of output excel file | |
U16String outputInsertingDeletingRowsAndColumns = outPath + u"outputInsertingDeletingRowsAndColumns.xlsx"; | |
//Read input excel file | |
Workbook workbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Inserting a column into the worksheet at 2nd position | |
worksheet.GetCells().InsertColumn(1); | |
//Save the Excel file. | |
workbook.Save(outputInsertingDeletingRowsAndColumns); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleInsertingDeletingRowsAndColumns = dirPath->StringAppend(new String("sampleInsertingDeletingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputInsertingDeletingRowsAndColumns = outPath->StringAppend(new String("outputInsertingDeletingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleInsertingDeletingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Inserting a row into the worksheet at 3rd position | |
worksheet->GetICells()->InsertRow(2); | |
//Save the Excel file. | |
workbook->Save(outputInsertingDeletingRowsAndColumns); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of output excel file | |
U16String outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors = outPath + u"outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors.xlsx"; | |
//Create a workbook | |
Workbook wb; | |
Color Red{ 0xff, 0xff, 0, 0 }; | |
Color Green{ 0xff, 0, 0x80, 0 }; | |
Color Blue{ 0xff, 0, 0, 0xff }; | |
//Create array of custom theme colors | |
Color clrs[12]; | |
//Vector<Aspose::Cells::Color> clrs(12); | |
//Background1 | |
clrs[0] = Red; | |
//Text1 | |
clrs[1] = Red; | |
//Background2 | |
clrs[2] = Red; | |
//Text2 | |
clrs[3] = Red; | |
//Accent1 | |
clrs[4] = Red; | |
//Accent2 | |
clrs[5] = Green; | |
//Accent3 | |
clrs[6] = Green; | |
//Accent4 | |
clrs[7] = Green; | |
//Accent5 | |
clrs[8] = Green; | |
//Accent6 | |
clrs[9] = Blue; | |
//Hyperlink | |
clrs[10] = Blue; | |
//Followed Hyperlink | |
clrs[11] = Blue; | |
//Apply custom theme colors on workbook | |
wb.CustomTheme(u"AnyTheme", Vector<Color>(clrs, 12)); | |
//Save the workbook | |
wb.Save(outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of output excel file | |
StringPtr outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors = outPath->StringAppend(new String("outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors.xlsx")); | |
//Create a workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Create array of custom theme colors | |
intrusive_ptr<Array1D<Systems::Drawing::Color*>> clrs = new Array1D<Systems::Drawing::Color*>(12); | |
//Background1 | |
clrs->SetValue(Systems::Drawing::Color::GetRed(), 0); | |
//Text1 | |
clrs->SetValue(Systems::Drawing::Color::GetRed(), 1); | |
//Background2 | |
clrs->SetValue(Systems::Drawing::Color::GetRed(), 2); | |
//Text2 | |
clrs->SetValue(Systems::Drawing::Color::GetRed(), 3); | |
//Accent1 | |
clrs->SetValue(Systems::Drawing::Color::GetRed(), 4); | |
//Accent2 | |
clrs->SetValue(Systems::Drawing::Color::GetGreen(), 5); | |
//Accent3 | |
clrs->SetValue(Systems::Drawing::Color::GetGreen(), 6); | |
//Accent4 | |
clrs->SetValue(Systems::Drawing::Color::GetGreen(), 7); | |
//Accent5 | |
clrs->SetValue(Systems::Drawing::Color::GetGreen(), 8); | |
//Accent6 | |
clrs->SetValue(Systems::Drawing::Color::GetBlue(), 9); | |
//Hyperlink | |
clrs->SetValue(Systems::Drawing::Color::GetBlue(), 10); | |
//Followed Hyperlink | |
clrs->SetValue(Systems::Drawing::Color::GetBlue(), 11); | |
//Apply custom theme colors on workbook | |
wb->CustomTheme(new String("AnyTheme"), clrs); | |
//Save the workbook | |
wb->Save(outputApplyCustomThemeColorsOfWorkbookUsingArrayOfColors); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u"..\\Data\\TechnicalArticles\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Paths of source and output excel files | |
U16String damaskPath = dirPath + u"DamaskTheme.xlsx"; | |
U16String sampleCopyThemeFromOneWorkbookToAnother = dirPath + u"sampleCopyThemeFromOneWorkbookToAnother.xlsx"; | |
U16String outputCopyThemeFromOneWorkbookToAnother = outPath + u"outputCopyThemeFromOneWorkbookToAnother.xlsx"; | |
//Read excel file that has Damask theme applied on it | |
Workbook damask(damaskPath); | |
//Read your sample excel file | |
Workbook wb(sampleCopyThemeFromOneWorkbookToAnother); | |
//Copy theme from source file | |
wb.CopyTheme(damask); | |
//Save the workbook in xlsx format | |
wb.Save(outputCopyThemeFromOneWorkbookToAnother, SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\TechnicalArticles\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Paths of source and output excel files | |
StringPtr damaskPath = dirPath->StringAppend(new String("DamaskTheme.xlsx")); | |
StringPtr sampleCopyThemeFromOneWorkbookToAnother = dirPath->StringAppend(new String("sampleCopyThemeFromOneWorkbookToAnother.xlsx")); | |
StringPtr outputCopyThemeFromOneWorkbookToAnother = outPath->StringAppend(new String("outputCopyThemeFromOneWorkbookToAnother.xlsx")); | |
//Read excel file that has Damask theme applied on it | |
intrusive_ptr<IWorkbook> damask = Factory::CreateIWorkbook(damaskPath); | |
//Read your sample excel file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleCopyThemeFromOneWorkbookToAnother); | |
//Copy theme from source file | |
wb->CopyTheme(damask); | |
//Save the workbook in xlsx format | |
wb->Save(outputCopyThemeFromOneWorkbookToAnother, SaveFormat_Xlsx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u"..\\Data\\TechnicalArticles\\"); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of input excel file | |
U16String sampleCreateAndManipulateExcelTable = dirPath + u"sampleCreateAndManipulateExcelTable.xlsx"; | |
//Path of output excel file | |
U16String outputCreateAndManipulateExcelTable = outPath + u"outputCreateAndManipulateExcelTable.xlsx"; | |
//Load the sample excel file | |
Workbook wb(sampleCreateAndManipulateExcelTable); | |
//Access first worksheet | |
Worksheet ws = wb.GetWorksheets().Get(0); | |
//Add table i.e. list object | |
int idx = ws.GetListObjects().Add(u"A1", u"H10", true); | |
//Access the newly added list object | |
ListObject lo = ws.GetListObjects().Get(idx); | |
//Use its display methods | |
lo.SetShowHeaderRow(true); | |
lo.SetShowTableStyleColumnStripes(true); | |
lo.SetShowTotals(true); | |
//Set its style | |
lo.SetTableStyleType(TableStyleType::TableStyleLight12); | |
//Set total functions of 3rd, 4th and 5th columns | |
lo.GetListColumns().Get(2).SetTotalsCalculation(TotalsCalculation::Min); | |
lo.GetListColumns().Get(3).SetTotalsCalculation(TotalsCalculation::Max); | |
lo.GetListColumns().Get(4).SetTotalsCalculation(TotalsCalculation::Count); | |
//Save the output excel file | |
wb.Save(outputCreateAndManipulateExcelTable); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr dirPath = new String("..\\Data\\TechnicalArticles\\"); | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of input excel file | |
StringPtr sampleCreateAndManipulateExcelTable = dirPath->StringAppend(new String("sampleCreateAndManipulateExcelTable.xlsx")); | |
//Path of output excel file | |
StringPtr outputCreateAndManipulateExcelTable = outPath->StringAppend(new String("outputCreateAndManipulateExcelTable.xlsx")); | |
//Load the sample excel file | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(sampleCreateAndManipulateExcelTable); | |
//Access first worksheet | |
intrusive_ptr<IWorksheet> ws = wb->GetIWorksheets()->GetObjectByIndex(0); | |
//Add table i.e. list object | |
int idx = ws->GetIListObjects()->Add(new String("A1"), new String("H10"), true); | |
//Access the newly added list object | |
intrusive_ptr<IListObject> lo = ws->GetIListObjects()->GetObjectByIndex(idx); | |
//Use its display methods | |
lo->SetShowHeaderRow(true); | |
lo->SetShowTableStyleColumnStripes(true); | |
lo->SetShowTotals(true); | |
//Set its style | |
lo->SetTableStyleType(TableStyleType_TableStyleLight12); | |
//Set total functions of 3rd, 4th and 5th columns | |
lo->GetIListColumns()->GetObjectByIndex(2)->SetTotalsCalculation(TotalsCalculation_Min); | |
lo->GetIListColumns()->GetObjectByIndex(3)->SetTotalsCalculation(TotalsCalculation_Max); | |
lo->GetIListColumns()->GetObjectByIndex(4)->SetTotalsCalculation(TotalsCalculation_Count); | |
//Save the output excel file | |
wb->Save(outputCreateAndManipulateExcelTable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Output directory path | |
U16String outPath(u"..\\Data\\Output\\"); | |
//Path of output excel file | |
U16String outputGroupRowsAndColumnsOfWorksheet = outPath + u"outputGroupRowsAndColumnsOfWorksheet.xlsx"; | |
//Create an empty workbook | |
Workbook wb; | |
//Add worksheet for grouping rows | |
Worksheet grpRows = wb.GetWorksheets().Get(0); | |
grpRows.SetName(u"GroupRows"); | |
//Add worksheet for grouping columns | |
int idx = wb.GetWorksheets().Add(); | |
Worksheet grpCols = wb.GetWorksheets().Get(idx); | |
grpCols.SetName(u"GroupColumns"); | |
//Add sample values in both worksheets | |
for (int i = 0; i < 50; i++) | |
{ | |
U16String str(u"Text"); | |
grpRows.GetCells().Get(i, 0).PutValue(str); | |
grpCols.GetCells().Get(0, i).PutValue(str); | |
} | |
//Grouping rows at first level | |
grpRows.GetCells().GroupRows(0, 10); | |
grpRows.GetCells().GroupRows(12, 22); | |
grpRows.GetCells().GroupRows(24, 34); | |
//Grouping rows at second level | |
grpRows.GetCells().GroupRows(2, 8); | |
grpRows.GetCells().GroupRows(14, 20); | |
grpRows.GetCells().GroupRows(28, 30); | |
//Grouping rows at third level | |
grpRows.GetCells().GroupRows(5, 7); | |
//Grouping columns at first level | |
grpCols.GetCells().GroupColumns(0, 10); | |
grpCols.GetCells().GroupColumns(12, 22); | |
grpCols.GetCells().GroupColumns(24, 34); | |
//Grouping columns at second level | |
grpCols.GetCells().GroupColumns(2, 8); | |
grpCols.GetCells().GroupColumns(14, 20); | |
grpCols.GetCells().GroupColumns(28, 30); | |
//Grouping columns at third level | |
grpCols.GetCells().GroupColumns(5, 7); | |
//Save the output excel file | |
wb.Save(outputGroupRowsAndColumnsOfWorksheet); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outPath = new String("..\\Data\\Output\\"); | |
//Path of output excel file | |
StringPtr outputGroupRowsAndColumnsOfWorksheet = outPath->StringAppend(new String("outputGroupRowsAndColumnsOfWorksheet.xlsx")); | |
//Create an empty workbook | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
//Add worksheet for grouping rows | |
intrusive_ptr<IWorksheet> grpRows = wb->GetIWorksheets()->GetObjectByIndex(0); | |
grpRows->SetName(new String("GroupRows")); | |
//Add worksheet for grouping columns | |
int idx = wb->GetIWorksheets()->Add(); | |
intrusive_ptr<IWorksheet> grpCols = wb->GetIWorksheets()->GetObjectByIndex(idx); | |
grpCols->SetName(new String("GroupColumns")); | |
//Add sample values in both worksheets | |
for (int i = 0; i<50; i++) | |
{ | |
intrusive_ptr<String> str = new String("Text"); | |
grpRows->GetICells()->GetObjectByIndex(i, 0)->PutValue(str); | |
grpCols->GetICells()->GetObjectByIndex(0, i)->PutValue(str); | |
} | |
//Grouping rows at first level | |
grpRows->GetICells()->GroupRows(0, 10); | |
grpRows->GetICells()->GroupRows(12, 22); | |
grpRows->GetICells()->GroupRows(24, 34); | |
//Grouping rows at second level | |
grpRows->GetICells()->GroupRows(2, 8); | |
grpRows->GetICells()->GroupRows(14, 20); | |
grpRows->GetICells()->GroupRows(28, 30); | |
//Grouping rows at third level | |
grpRows->GetICells()->GroupRows(5, 7); | |
//Grouping columns at first level | |
grpCols->GetICells()->GroupColumns(0, 10); | |
grpCols->GetICells()->GroupColumns(12, 22); | |
grpCols->GetICells()->GroupColumns(24, 34); | |
//Grouping columns at second level | |
grpCols->GetICells()->GroupColumns(2, 8); | |
grpCols->GetICells()->GroupColumns(14, 20); | |
grpCols->GetICells()->GroupColumns(28, 30); | |
//Grouping columns at third level | |
grpCols->GetICells()->GroupColumns(5, 7); | |
//Save the output excel file | |
wb->Save(outputGroupRowsAndColumnsOfWorksheet); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
SystemTimeInterruptMonitor monitor(false); | |
LoadOptions lopts; | |
lopts.SetInterruptMonitor((AbstractInterruptMonitor*) & monitor); | |
monitor.StartMonitor(1000); //time limit is 1 second | |
Workbook wb(u"Large.xlsx", lopts); | |
//if the time cost of loading the template file exceeds one second, interruption will be required and exception will be thrown here | |
//otherwise starts to monitor the save procedure | |
monitor.StartMonitor(1500); //time limit is 1.5 seconds | |
wb.Save(u"result.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleCopyingAndMovingWorksheets = srcDir + u"sampleCopyingAndMovingWorksheets.xlsx"; | |
//Path of output excel file | |
U16String outputCopyingAndMovingWorksheets = outDir + u"outputCopyingAndMovingWorksheets.xlsx"; | |
//Create workbook | |
Workbook workbook(sampleCopyingAndMovingWorksheets); | |
//Create worksheets object with reference to the sheets of the workbook. | |
WorksheetCollection sheets = workbook.GetWorksheets(); | |
//Copy data to a new sheet from an existing sheet within the workbook. | |
sheets.AddCopy(u"Sheet1"); | |
//Save the Excel file. | |
workbook.Save(outputCopyingAndMovingWorksheets); | |
std::cout << "Worksheet copied successfully with in a workbook!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleCopyingAndMovingWorksheets = srcDir->StringAppend(new String("sampleCopyingAndMovingWorksheets.xlsx")); | |
//Path of output excel file | |
StringPtr outputCopyingAndMovingWorksheets = outDir->StringAppend(new String("outputCopyingAndMovingWorksheets.xlsx")); | |
//Create workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleCopyingAndMovingWorksheets); | |
//Create worksheets object with reference to the sheets of the workbook. | |
intrusive_ptr<IWorksheetCollection> sheets = workbook->GetIWorksheets(); | |
//Copy data to a new sheet from an existing sheet within the workbook. | |
sheets->AddCopy(new String("Test1")); | |
//Save the Excel file. | |
workbook->Save(outputCopyingAndMovingWorksheets); | |
StringPtr msg = new String("Worksheet copied successfully with in a workbook!"); | |
Console::WriteLine(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleCopyingAndMovingWorksheets = srcDir + u"sampleCopyingAndMovingWorksheets.xlsx"; | |
//Path of output excel file | |
U16String outputCopyingAndMovingWorksheets = outDir + u"outputCopyingAndMovingWorksheets.xlsx"; | |
//Create workbook | |
Workbook workbook(sampleCopyingAndMovingWorksheets); | |
//Create worksheets object with reference to the sheets of the workbook. | |
WorksheetCollection sheets = workbook.GetWorksheets(); | |
//Access the first sheet | |
Worksheet sheet = sheets.Get(0); | |
//Move the first sheet to the third position in the workbook. | |
sheet.MoveTo(2); | |
//Save the Excel file. | |
workbook.Save(outputCopyingAndMovingWorksheets); | |
std::cout << "Worksheet moved successfully with in a workbook!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleCopyingAndMovingWorksheets = srcDir->StringAppend(new String("sampleCopyingAndMovingWorksheets.xlsx")); | |
//Path of output excel file | |
StringPtr outputCopyingAndMovingWorksheets = outDir->StringAppend(new String("outputCopyingAndMovingWorksheets.xlsx")); | |
//Create workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleCopyingAndMovingWorksheets); | |
//Create worksheets object with reference to the sheets of the workbook. | |
intrusive_ptr<IWorksheetCollection> sheets = workbook->GetIWorksheets(); | |
//Access the first sheet | |
intrusive_ptr<IWorksheet> sheet = sheets->GetObjectByIndex(0); | |
//Move the first sheet to the third position in the workbook. | |
sheet->MoveTo(2); | |
//Save the Excel file. | |
workbook->Save(outputCopyingAndMovingWorksheets); | |
StringPtr msg = new String("Worksheet moved successfully with in a workbook!"); | |
Console::WriteLine(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Path of input excel file | |
U16String sampleManageWorksheets = srcDir + u"sampleManageWorksheets.xlsx"; | |
//Load the sample Excel file | |
Workbook workbook(sampleManageWorksheets); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Access the cell by its name. | |
Cell cell = worksheet.GetCells().Get(u"F7"); | |
//Print the value of cell F7 | |
U16String val = cell.GetStringValue(); | |
//Print the value on console. | |
std::cout << "Value of cell F7: " << val.ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleManageWorksheets = srcDir->StringAppend(new String("sampleManageWorksheets.xlsx")); | |
//Load the sample Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleManageWorksheets); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Access the cell by its name. | |
intrusive_ptr<ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("F7")); | |
//Print the value of cell F7 | |
StringPtr val = cell->GetStringValue(); | |
//Print the value on console. | |
Console::Write(new String("Value of cell F7: ")); | |
Console::WriteLine(val); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of output excel file | |
U16String outputManageWorksheets = outDir + u"outputManageWorksheets.xlsx"; | |
//Create workbook | |
Workbook workbook; | |
// Adding a new worksheet to the Workbook object | |
int i = workbook.GetWorksheets().Add(); | |
// Obtaining the reference of the newly added worksheet by passing its sheet index | |
Worksheet worksheet = workbook.GetWorksheets().Get(i); | |
// Setting the name of the newly added worksheet | |
worksheet.SetName(u"My Worksheet"); | |
// Save the Excel file. | |
workbook.Save(outputManageWorksheets); | |
std::cout <<"New worksheet added successfully with in a workbook!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of output excel file | |
StringPtr outputManageWorksheets = outDir->StringAppend(new String("outputManageWorksheets.xlsx")); | |
//Create workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Adding a new worksheet to the Workbook object | |
int i = workbook->GetIWorksheets()->Add(); | |
// Obtaining the reference of the newly added worksheet by passing its sheet index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(i); | |
// Setting the name of the newly added worksheet | |
worksheet->SetName(new String("My Worksheet")); | |
// Save the Excel file. | |
workbook->Save(outputManageWorksheets); | |
StringPtr msg = new String("New worksheet added successfully with in a workbook!"); | |
Console::WriteLine(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleManageWorksheets = srcDir + u"sampleManageWorksheets.xlsx"; | |
//Path of output excel file | |
U16String outputManageWorksheets = outDir + u"outputManageWorksheets.xlsx"; | |
//Load the sample Excel file | |
Workbook workbook(sampleManageWorksheets); | |
//Removing a worksheet using its sheet index | |
workbook.GetWorksheets().RemoveAt(0); | |
//Save the Excel file. | |
workbook.Save(outputManageWorksheets); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleManageWorksheets = srcDir->StringAppend(new String("sampleManageWorksheets.xlsx")); | |
//Path of output excel file | |
StringPtr outputManageWorksheets = outDir->StringAppend(new String("outputManageWorksheets.xlsx")); | |
//Load the sample Excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleManageWorksheets); | |
//Removing a worksheet using its sheet index | |
workbook->GetIWorksheets()->RemoveAt(0); | |
//Save the Excel file. | |
workbook->Save(outputManageWorksheets); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of output excel file | |
U16String outputPageBreaks = outDir + u"outputManagingPageBreaks.xlsx"; | |
//Instantiating a Workbook object | |
Workbook workbook; | |
//Add a page break at cell J20 | |
workbook.GetWorksheets().Get(0).AddPageBreaks(u"J20"); | |
//Save the Excel file. | |
workbook.Save(outputPageBreaks); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of output excel file | |
StringPtr outputPageBreaks = outDir->StringAppend(new String("outputManagingPageBreaks.xlsx")); | |
//Instantiating a Workbook object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
//Add a page break at cell J20 | |
workbook->GetIWorksheets()->GetObjectByIndex(0)->AddPageBreaks(new String("J20")); | |
//Save the Excel file. | |
workbook->Save(outputPageBreaks); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleWorksheetViews = srcDir + u"sampleWorksheetViews.xlsx"; | |
//Path of input excel file | |
U16String outputWorksheetViews = outDir + u"outputWorksheetViews.xlsx"; | |
//Instantiate a workbook object | |
Workbook workbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Displaying the worksheet in page break preview | |
worksheet.SetIsPageBreakPreview(true); | |
//Save the Excel file | |
workbook.Save(outputWorksheetViews); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleWorksheetViews = srcDir->StringAppend(new String("sampleWorksheetViews.xlsx")); | |
//Path of input excel file | |
StringPtr outputWorksheetViews = outDir->StringAppend(new String("outputWorksheetViews.xlsx")); | |
//Instantiate a workbook object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Displaying the worksheet in page break preview | |
worksheet->SetIsPageBreakPreview(true); | |
//Save the Excel file | |
workbook->Save(outputWorksheetViews); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleWorksheetViews = srcDir + u"sampleWorksheetViews.xlsx"; | |
//Path of input excel file | |
U16String outputWorksheetViews = outDir + u"outputWorksheetViews.xlsx"; | |
//Instantiating a Workbook object and opening the Excel file through the file stream | |
Workbook workbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Applying freeze panes settings | |
worksheet.FreezePanes(3, 2, 3, 2); | |
//Saving the modified Excel file | |
workbook.Save(outputWorksheetViews); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleWorksheetViews = srcDir->StringAppend(new String("sampleWorksheetViews.xlsx")); | |
//Path of input excel file | |
StringPtr outputWorksheetViews = outDir->StringAppend(new String("outputWorksheetViews.xlsx")); | |
//Instantiating a Workbook object and opening the Excel file through the file stream | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Applying freeze panes settings | |
worksheet->FreezePanes(3, 2, 3, 2); | |
//Saving the modified Excel file | |
workbook->Save(outputWorksheetViews); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleWorksheetViews = srcDir + u"sampleWorksheetViews.xlsx"; | |
//Path of input excel file | |
U16String outputWorksheetViews = outDir + u"outputWorksheetViews.xlsx"; | |
//Instantiating a Workbook object | |
Workbook workbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Set the active cell | |
worksheet.SetActiveCell(u"A20"); | |
// Split the worksheet window | |
worksheet.RemoveSplit(); | |
//Saving the modified Excel file | |
workbook.Save(outputWorksheetViews); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleWorksheetViews = srcDir->StringAppend(new String("sampleWorksheetViews.xlsx")); | |
//Path of input excel file | |
StringPtr outputWorksheetViews = outDir->StringAppend(new String("outputWorksheetViews.xlsx")); | |
//Instantiating a Workbook object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Set the active cell | |
worksheet->SetActiveCell(new String("A20")); | |
// Split the worksheet window | |
worksheet->RemoveSplit(); | |
//Saving the modified Excel file | |
workbook->Save(outputWorksheetViews); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleWorksheetViews = srcDir + u"sampleWorksheetViews.xlsx"; | |
//Path of input excel file | |
U16String outputWorksheetViews = outDir + u"outputWorksheetViews.xlsx"; | |
//Instantiating a Workbook object | |
Workbook workbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Set the active cell | |
worksheet.SetActiveCell(u"A20"); | |
//Split the worksheet window | |
worksheet.Split(); | |
//Saving the modified Excel file | |
workbook.Save(outputWorksheetViews); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleWorksheetViews = srcDir->StringAppend(new String("sampleWorksheetViews.xlsx")); | |
//Path of input excel file | |
StringPtr outputWorksheetViews = outDir->StringAppend(new String("outputWorksheetViews.xlsx")); | |
//Instantiating a Workbook object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Set the active cell | |
worksheet->SetActiveCell(new String("A20")); | |
//Split the worksheet window | |
worksheet->Split(); | |
//Saving the modified Excel file | |
workbook->Save(outputWorksheetViews); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
U16String sampleWorksheetViews = srcDir + u"sampleWorksheetViews.xlsx"; | |
//Path of input excel file | |
U16String outputWorksheetViews = outDir + u"outputWorksheetViews.xlsx"; | |
//Instantiate a workbook object | |
Workbook workbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Setting the zoom factor of the worksheet to 75 | |
worksheet.SetZoom(75); | |
// Saving the modified Excel file | |
workbook.Save(outputWorksheetViews); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
//Output directory path | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
//Path of input excel file | |
StringPtr sampleWorksheetViews = srcDir->StringAppend(new String("sampleWorksheetViews.xlsx")); | |
//Path of input excel file | |
StringPtr outputWorksheetViews = outDir->StringAppend(new String("outputWorksheetViews.xlsx")); | |
//Instantiate a workbook object | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleWorksheetViews); | |
//Accessing a worksheet using its index | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Setting the zoom factor of the worksheet to 75 | |
worksheet->SetZoom(75); | |
// Saving the modified Excel file | |
workbook->Save(outputWorksheetViews); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
using namespace Aspose::Cells; | |
int main(void) | |
{ | |
Aspose::Cells::Startup(); | |
try | |
{ | |
// Create a License object | |
License license; | |
// Set the license of Aspose.Cells to avoid the evaluation limitations | |
license.SetLicense(u"Aspose.Cells.lic"); | |
// Instantiate a Workbook object that represents Excel file. | |
Workbook wb; | |
// When you create a new workbook, a default "Sheet1" is added to the workbook. | |
Worksheet sheet = wb.GetWorksheets().Get(0); | |
// Access the "A1" cell in the sheet. | |
Cell cell = sheet.GetCells().Get(u"A1"); | |
// Input the "Hello World!" text into the "A1" cell | |
cell.PutValue(u"Hello World!"); | |
// Save the Excel file. | |
wb.Save(u"MyBook_out.xlsx"); | |
} | |
catch (const CellsException& ex) | |
{ | |
std::cout << ex.GetErrorMessage().ToUtf8() << std::endl; | |
} | |
Aspose::Cells::Cleanup(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
int main(void) | |
{ | |
try | |
{ | |
// Create a License object | |
intrusive_ptr<License> license = new License(); | |
// Set the license of Aspose.Cells to avoid the evaluation limitations | |
license->SetLicense(new String("Aspose.Cells.lic")); | |
// Instantiate a Workbook object that represents Excel file. | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(); | |
// When you create a new workbook, a default "Sheet1" is added to the workbook. | |
intrusive_ptr <IWorksheet> sheet = wb->GetIWorksheets()->GetObjectByIndex(0); | |
// Access the "A1" cell in the sheet. | |
intrusive_ptr <ICell> cell = sheet->GetICells()->GetObjectByIndex(new String("A1")); | |
// Input the "Hello World!" text into the "A1" cell | |
cell->PutValue((StringPtr)(new String("Hello World!"))); | |
// Save the Excel file. | |
wb->Save(new String("MyBook_out.xlsx")); | |
} | |
catch (Exception& ex) | |
{ | |
Console::WriteLine(ex.GetMessageExp()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
using namespace Aspose::Cells; | |
/*Check result*/ | |
#define EXPECT_TRUE(condition) \ | |
if (condition) printf("--%s,line:%d -> Ok --\n", __FUNCTION__, __LINE__); \ | |
else printf("--%s,line:%d->>>> Failed!!!! <<<<--\n", __FUNCTION__, __LINE__); | |
int main(void) | |
{ | |
Aspose::Cells::Startup(); | |
try | |
{ | |
// Create a License object | |
License license; | |
// Set the license of Aspose.Cells to avoid the evaluation limitations | |
//license.SetLicense(u"Aspose.Cells.lic"); | |
// Instantiate a Workbook object that represents Excel file. | |
Workbook wb;//(u"MyBook_out.xlsx"); | |
// When you create a new workbook, a default "Sheet1" is added to the workbook. | |
Worksheet sheet = wb.GetWorksheets().Get(0); | |
// Access the "A1" cell in the sheet. | |
Cell cell = sheet.GetCells().Get(u"A1"); | |
U16String strRet = cell.GetStringValue(); | |
//check value | |
EXPECT_TRUE(strRet == u"Hello World!"); | |
// Save the Excel file. | |
wb.Save(u"MyBook_out.xlsx"); | |
} | |
catch (const CellsException& ex) | |
{ | |
std::cout << ex.GetErrorMessage().ToUtf8() << std::endl; | |
} | |
Aspose::Cells::Cleanup(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
/*Check result*/ | |
#define EXPECT_TRUE(condition) \ | |
if (condition) printf("--%s,line:%d -> Ok --\n", __FUNCTION__, __LINE__); \ | |
else printf("--%s,line:%d->>>> Failed!!!! <<<<--\n", __FUNCTION__, __LINE__); | |
int main(void) | |
{ | |
try | |
{ | |
// Create a License object | |
intrusive_ptr<License> license = new License(); | |
// Set the license of Aspose.Cells to avoid the evaluation limitations | |
//license->SetLicense(new String("Aspose.Cells.lic")); | |
// Instantiate a Workbook object that represents Excel file. | |
intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook(new String("MyBook_out.xlsx")); | |
// When you create a new workbook, a default "Sheet1" is added to the workbook. | |
intrusive_ptr <IWorksheet> sheet = wb->GetIWorksheets()->GetObjectByIndex(0); | |
// Access the "A1" cell in the sheet. | |
intrusive_ptr <ICell> cell = sheet->GetICells()->GetObjectByIndex(new String("A1")); | |
StringPtr strRet = cell->GetStringValue(); | |
//check value | |
EXPECT_TRUE(StringHelperPal::Compare(strRet,(StringPtr)(new String("Hello World!")))==0); | |
// Save the Excel file. | |
wb->Save(new String("MyBook_out.xlsx")); | |
} | |
catch (Exception& ex) | |
{ | |
Console::WriteLine(ex.GetMessageExp()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
int main(void) | |
{ | |
try | |
{ | |
// Create a License object | |
intrusive_ptr<License> license = new License(); | |
// Set the license of Aspose.Cells to avoid the evaluation limitations | |
license->SetLicense(new String("Aspose.Cells.lic")); | |
// Create a LoadOption | |
intrusive_ptr<Aspose::Cells::ILoadOptions> loadOpt = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Xlsx); | |
// Set the password with 123 for LoadOption | |
loadOpt->SetPassword(new String("123")); | |
// Open your encrypted file will throw exception | |
intrusive_ptr<Aspose::Cells::IWorkbook> wb = Factory::CreateIWorkbook(sourcePath->StringAppend(new String("Bookpassword.xlsx")), loadOpt); | |
} | |
catch (Exception& ex) | |
{ | |
Console::WriteLine(ex.GetMessageExp()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
U16String dataDir = u""; | |
Aspose::Cells::Startup(); | |
Workbook workbook(dataDir + u"yourFile"); | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.GetWorksheets().Get(0); | |
// Select picture object via its index from 'Pictures' attribute of Worksheet. | |
Picture pic = sheet.GetPictures().Get(0); | |
//print display size | |
std::cout << "display size: w=" << pic.GetWidth() << " h=" << pic.GetHeight() << std::endl; | |
//print original size | |
std::cout << "original size: w=" << pic.GetOriginalWidth() << " h=" << pic.GetOriginalHeight() << std::endl; | |
//print scaling | |
std::cout << "scaling: sw=" << pic.GetWidthScale() << "% sh=" << pic.GetHeightScale() << "%" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
U16String dataDir = u""; | |
Aspose::Cells::Startup(); | |
// Instantiating a Workbook object | |
Workbook workbook; | |
// Adding a new worksheet to the Excel object | |
int i = workbook.GetWorksheets().Add(); | |
// Obtaining the reference of the newly added worksheet by passing its sheet index | |
Worksheet newSheet = workbook.GetWorksheets().Get(i); | |
newSheet.SetName(u"Sheet2"); | |
// Obtaining the reference of the first worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding a hyperlink to a URL at "A1" cell | |
worksheet.GetHyperlinks().Add(u"A1", 1, 1, "http://www.aspose.com"); | |
// Adding an internal hyperlink to the "B9" cell of the other worksheet "Sheet2" in the same Excel file | |
worksheet.GetHyperlinks().Add(u"B3", 1, 1, u"Sheet2!B9"); | |
// Saving the Excel file | |
workbook.Save(dataDir + u"out.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Arc to the worksheet | |
worksheet.GetShapes().AddArc(1, 0, 1, 0, 100, 100); | |
//or worksheet.GetShapes().AddAutoShape(AutoShapeType::Arc, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Arc to the worksheet | |
worksheet->GetIShapes()->AddIArc(1, 0, 1, 0, 100, 100); | |
//or worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_Arc, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Block Arrows to the worksheet | |
worksheet.GetShapes().AddAutoShape(AutoShapeType::RightArrow, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Block Arrows to the worksheet | |
worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_RightArrow, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Callouts to the worksheet | |
worksheet.GetShapes().AddAutoShape(AutoShapeType::CloudCallout, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Callouts to the worksheet | |
worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_CloudCallout, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Get first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Cube to the worksheet | |
worksheet.GetShapes().AddAutoShape(AutoShapeType::Cube, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Cube to the worksheet | |
worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_Cube, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
Workbook workbook; | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.GetWorksheets().Get(0); | |
//curved shape | |
Shape curve = sheet.GetShapes().AddAutoShape(AutoShapeType::CurvedConnector, 2, 0, 2, 0, 100, 300); | |
//curved arrow shape | |
Shape curve1 = sheet.GetShapes().AddAutoShape(AutoShapeType::CurvedConnector, 4, 0, 2, 0, 100, 300); | |
curve1.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//curved double-arrow shape | |
Shape curve2 = sheet.GetShapes().AddAutoShape(AutoShapeType::CurvedConnector, 6, 0, 2, 0, 100, 300); | |
curve2.GetLine().SetBeginArrowheadStyle(MsoArrowheadStyle::Arrow); | |
curve2.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//Save.You can check your line in this way. | |
workbook.Save("sample.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
Workbook workbook; | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.GetWorksheets().Get(0); | |
//elbow | |
Shape elbow = sheet.GetShapes().AddAutoShape(AutoShapeType::ElbowConnector, 2, 0, 2, 0, 100, 300); | |
//elbow: arrow | |
Shape elbowArrow1 = sheet.GetShapes().AddAutoShape(AutoShapeType::ElbowConnector, 4, 0, 2, 0, 100, 300); | |
elbowArrow1.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//elbow: double-arrow | |
Shape elbowArrow2 = sheet.GetShapes().AddAutoShape(AutoShapeType::ElbowConnector, 6, 0, 2, 0, 100, 300); | |
elbowArrow2.GetLine().SetBeginArrowheadStyle(MsoArrowheadStyle::Arrow); | |
elbowArrow2.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//Save.You can check your line in this way. | |
workbook.Save(path + "sample.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Equation shapes to the worksheet | |
worksheet.GetShapes().AddAutoShape(AutoShapeType::MathPlus, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Equation shapes to the worksheet | |
worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_MathPlus, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding FlowChart to the worksheet | |
worksheet.GetShapes().AddAutoShape(AutoShapeType::FlowChartMultidocument, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding FlowChart to the worksheet | |
worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_FlowChartMultidocument, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Line to the worksheet | |
worksheet.GetShapes().AddLine(1, 0, 1, 0, 100, 100); | |
//or worksheet.GetShapes().AddAutoShape(AutoShapeType::Line, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Line to the worksheet | |
worksheet->GetIShapes()->AddILine(1, 0, 1, 0, 100, 100); | |
//or worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_Line, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Oval to the worksheet | |
worksheet.GetShapes().AddOval(1, 0, 1, 0, 100, 100); | |
//or worksheet.GetShapes().AddAutoShape(AutoShapeType::Oval, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Oval to the worksheet | |
worksheet->GetIShapes()->AddIOval(1, 0, 1, 0, 100, 100); | |
//or worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_Oval, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
U16String dataDir = u""; | |
Aspose::Cells::Startup(); | |
// Instantiating a Workbook object | |
Workbook workbook; | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.GetWorksheets().Get(0); | |
// Add the pictureto the worksheet | |
//method 1 | |
Vector<uint8_t> fs(0);//Read the image data into this variable | |
//todo | |
sheet.GetShapes().AddPicture(1, 0, 1, 0, fs); | |
//method 2 | |
sheet.GetPictures().Add(5, 5, dataDir + u"image1.jpeg"); | |
//Save | |
workbook.Save(dataDir + u"sample.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding Rectangle to the worksheet | |
worksheet.GetShapes().AddRectangle(1, 0, 1, 0, 100, 100); | |
//or worksheet.GetShapes().AddAutoShape(AutoShapeType::Rectangle, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding Rectangle to the worksheet | |
worksheet->GetIShapes()->AddIRectangle(1, 0, 1, 0, 100, 100); | |
//or worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_Rectangle, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
Workbook workbook; | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.GetWorksheets().Get(0); | |
//straight arrow | |
LineShape straightArrow = sheet.GetShapes().AddLine(2, 0, 2, 0, 100, 300); | |
straightArrow.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//double straight arrow | |
LineShape doubleStraightArrow = sheet.GetShapes().AddLine(4, 0, 2, 0, 100, 300); | |
doubleStraightArrow.GetLine().SetBeginArrowheadStyle(MsoArrowheadStyle::Arrow); | |
doubleStraightArrow.GetLine().SetEndArrowheadStyle(MsoArrowheadStyle::Arrow); | |
//Save.You can check your line in this way. | |
workbook.Save(path + "sample.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Create a new workbook | |
Workbook workbook; | |
// Gets first worksheet which is created by default | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Adding TextBox to the worksheet | |
worksheet.GetShapes().AddTextBox(1, 0, 1, 0, 100, 100); | |
//or worksheet.GetShapes().AddAutoShape(AutoShapeType::TextBox, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook.Save(u"resFile.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Get first worksheet which is created by default | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Adding TextBox to the worksheet | |
worksheet->GetIShapes()->AddITextBox(1, 0, 1, 0, 100, 100); | |
//or worksheet->GetIShapes()->AddAutoIShape(AutoShapeType::AutoShapeType_TextBox, 1, 0, 1, 0, 100, 100); | |
// Saving the excel file | |
workbook->Save(new String("resFile.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output Pdf file. | |
U16String outputConvertExcelWorkbookToPDF = outDir+ u"outputConvertExcelWorkbookToPDF_PdfCompliance_PdfA1b.pdf"; | |
// Create an empty workbook. | |
Workbook workbook; | |
// Access first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access cell A1. | |
Cell cell = worksheet.GetCells().Get(u"A1"); | |
// Add some text in cell. | |
cell.PutValue(u"Testing PDF/A"); | |
// Create pdf save options object. | |
PdfSaveOptions pdfSaveOptions; | |
// Set the compliance to PDF/A-1b. | |
pdfSaveOptions.SetCompliance(PdfCompliance::PdfA1b); | |
// Save the Excel Document in PDF format | |
workbook.Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output Pdf file. | |
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_PdfCompliance_PdfA1b.pdf")); | |
// Create an empty workbook. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Access first worksheet. | |
intrusive_ptr<Aspose::Cells::IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Access cell A1. | |
intrusive_ptr<Aspose::Cells::ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("A1")); | |
// Add some text in cell. | |
cell->PutValue((StringPtr)new String("Testing PDF/A")); | |
// Create pdf save options object. | |
intrusive_ptr<Aspose::Cells::IPdfSaveOptions> pdfSaveOptions = Factory::CreateIPdfSaveOptions(); | |
// Set the compliance to PDF/A-1b. | |
pdfSaveOptions->SetCompliance(Aspose::Cells::Rendering::PdfCompliance_PdfA1b); | |
// Save the Excel Document in PDF format | |
workbook->Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file | |
U16String sampleConvertExcelWorkbookToPDF = srcDir+ u"sampleConvertExcelWorkbookToPDF.xlsx"; | |
// Path of output Pdf file | |
U16String outputConvertExcelWorkbookToPDF = outDir+ u"outputConvertExcelWorkbookToPDF_DirectConversion.pdf"; | |
// Load the sample Excel file. | |
Workbook workbook(sampleConvertExcelWorkbookToPDF); | |
// Save the Excel Document in PDF format | |
workbook.Save(outputConvertExcelWorkbookToPDF, SaveFormat::Pdf); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file | |
StringPtr sampleConvertExcelWorkbookToPDF = srcDir->StringAppend(new String("sampleConvertExcelWorkbookToPDF.xlsx")); | |
// Path of output Pdf file | |
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_DirectConversion.pdf")); | |
// Load the sample Excel file. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertExcelWorkbookToPDF); | |
// Save the Excel Document in PDF format | |
workbook->Save(outputConvertExcelWorkbookToPDF, SaveFormat_Pdf); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of output Pdf file. | |
U16String outputConvertExcelWorkbookToPDF = outDir + u"outputConvertExcelWorkbookToPDF_PDFCreationTime.pdf"; | |
// Create an empty workbook. | |
Workbook workbook; | |
// Access first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Access cell A1. | |
Cell cell = worksheet.GetCells().Get(u"A1"); | |
// Add some text in cell. | |
cell.PutValue(u"PDF Creation Time is 25-May-2017."); | |
// Create pdf save options object. | |
PdfSaveOptions pdfSaveOptions; | |
// Set the created time for the PDF i.e. 25-May-2017 | |
pdfSaveOptions.SetCreatedTime(Date{2017, 5, 25}); | |
// Save the Excel Document in PDF format | |
workbook.Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of output Pdf file. | |
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_PDFCreationTime.pdf")); | |
// Create an empty workbook. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(); | |
// Access first worksheet. | |
intrusive_ptr<Aspose::Cells::IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Access cell A1. | |
intrusive_ptr<Aspose::Cells::ICell> cell = worksheet->GetICells()->GetObjectByIndex(new String("A1")); | |
// Add some text in cell. | |
cell->PutValue((StringPtr)new String("PDF Creation Time is 25-May-2017.")); | |
// Create pdf save options object. | |
intrusive_ptr<Aspose::Cells::IPdfSaveOptions> pdfSaveOptions = Factory::CreateIPdfSaveOptions(); | |
// Set the created time for the PDF i.e. 25-May-2017 | |
pdfSaveOptions->SetCreatedTime(new Aspose::Cells::Systems::DateTime(2017, 5, 25)); | |
// Save the Excel Document in PDF format | |
workbook->Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
U16String sampleConvertingWorksheetToDifferentImageFormats = srcDir + u"sampleConvertingWorksheetToDifferentImageFormats.xlsx"; | |
// Create an empty workbook. | |
Workbook workbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Create image or print options object. | |
ImageOrPrintOptions imgOptions; | |
// Specify the image format. | |
imgOptions.SetImageType(ImageType::Png); | |
// Specify horizontal and vertical resolution | |
imgOptions.SetHorizontalResolution(200); | |
imgOptions.SetVerticalResolution(200); | |
// Render the sheet with respect to specified image or print options. | |
SheetRender sr(worksheet, imgOptions); | |
// Get page count. | |
int pageCount = sr.GetPageCount(); | |
// Create string builder object for string concatenations. | |
std::string sb; | |
// Render each page to png image one by one. | |
for (int i = 0; i < pageCount; i++) | |
{ | |
// Clear string builder and create output image path with string concatenations. | |
sb = ""; | |
sb += outDir.ToUtf8(); | |
sb += "outputConvertingWorksheetToImagePNG_"; | |
sb += std::to_string(i); | |
sb += ".png"; | |
// Get the output image path. | |
U16String outputPNG(sb.c_str()); | |
// Convert worksheet to png image. | |
sr.ToImage(i, outputPNG); | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
StringPtr sampleConvertingWorksheetToDifferentImageFormats = srcDir->StringAppend(new String("sampleConvertingWorksheetToDifferentImageFormats.xlsx")); | |
// Create an empty workbook. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
intrusive_ptr<Aspose::Cells::IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Create image or print options object. | |
intrusive_ptr<Aspose::Cells::Rendering::IImageOrPrintOptions> imgOptions = Factory::CreateIImageOrPrintOptions(); | |
// Specify the image format. | |
imgOptions->SetImageFormat(Aspose::Cells::Systems::Drawing::Imaging::ImageFormat::GetPng()); | |
// Specify horizontal and vertical resolution | |
imgOptions->SetHorizontalResolution(200); | |
imgOptions->SetVerticalResolution(200); | |
// Render the sheet with respect to specified image or print options. | |
intrusive_ptr<Aspose::Cells::Rendering::ISheetRender> sr = Factory::CreateISheetRender(worksheet, imgOptions); | |
// Get page count. | |
Aspose::Cells::Systems::Int32 pageCount = sr->GetPageCount(); | |
// Create string builder object for string concatenations. | |
intrusive_ptr<Aspose::Cells::Systems::Text::StringBuilder> sb = new Aspose::Cells::Systems::Text::StringBuilder(); | |
// Render each page to png image one by one. | |
for (int i = 0; i < pageCount; i++) | |
{ | |
// Clear string builder and create output image path with string concatenations. | |
sb->Clear(); | |
sb->Append(outDir); | |
sb->Append((StringPtr)new String("outputConvertingWorksheetToImagePNG_")); | |
sb->Append(i); | |
sb->Append((StringPtr)new String(".png")); | |
// Get the output image path. | |
StringPtr outputPNG = sb->ToString(); | |
// Convert worksheet to png image. | |
sr->ToImage(i, outputPNG); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
U16String sampleConvertingWorksheetToDifferentImageFormats = srcDir + u"sampleConvertingWorksheetToDifferentImageFormats.xlsx"; | |
// Create an empty workbook. | |
Workbook workbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Create image or print options object. | |
ImageOrPrintOptions imgOptions; | |
// Specify the image format. | |
imgOptions.SetImageType(ImageType::Svg); | |
// Specify horizontal and vertical resolution | |
imgOptions.SetHorizontalResolution(200); | |
imgOptions.SetVerticalResolution(200); | |
// Render the sheet with respect to specified image or print options. | |
SheetRender sr(worksheet, imgOptions); | |
// Get page count. | |
int pageCount = sr.GetPageCount(); | |
// Create string builder object for string concatenations. | |
std::string sb; | |
// Render each page to png image one by one. | |
for (int i = 0; i < pageCount; i++) | |
{ | |
// Clear string builder and create output image path with string concatenations. | |
sb = ""; | |
sb += outDir.ToUtf8(); | |
sb += "outputConvertingWorksheetToImageSVG_"; | |
sb += std::to_string(i); | |
sb += ".svg"; | |
// Get the output image path. | |
U16String outputSvg(sb.c_str()); | |
// Convert worksheet to svg image. | |
sr.ToImage(i, outputSvg); | |
} | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
StringPtr sampleConvertingWorksheetToDifferentImageFormats = srcDir->StringAppend(new String("sampleConvertingWorksheetToDifferentImageFormats.xlsx")); | |
// Create an empty workbook. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
intrusive_ptr<Aspose::Cells::IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Create image or print options object. | |
intrusive_ptr<Aspose::Cells::Rendering::IImageOrPrintOptions> imgOptions = Factory::CreateIImageOrPrintOptions(); | |
// Specify horizontal and vertical resolution | |
imgOptions->SetHorizontalResolution(200); | |
imgOptions->SetVerticalResolution(200); | |
// Specify the save format. | |
imgOptions->SetSaveFormat(Aspose::Cells::SaveFormat::SaveFormat_SVG); | |
// Render the sheet with respect to specified image or print options. | |
intrusive_ptr<Aspose::Cells::Rendering::ISheetRender> sr = Factory::CreateISheetRender(worksheet, imgOptions); | |
// Get page count. | |
Aspose::Cells::Systems::Int32 pageCount = sr->GetPageCount(); | |
// Create string builder object for string concatenations. | |
intrusive_ptr<Aspose::Cells::Systems::Text::StringBuilder> sb = new Aspose::Cells::Systems::Text::StringBuilder(); | |
// Render each page to png image one by one. | |
for (int i = 0; i < pageCount; i++) | |
{ | |
// Clear string builder and create output image path with string concatenations. | |
sb->Clear(); | |
sb->Append(outDir); | |
sb->Append((StringPtr)new String("outputConvertingWorksheetToImageSVG_")); | |
sb->Append(i); | |
sb->Append((StringPtr)new String(".svg")); | |
// Get the output image path. | |
StringPtr outputSVG = sb->ToString(); | |
// Convert worksheet to tiff image. | |
sr->ToImage(i, outputSVG); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
U16String srcDir(u"..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
U16String outDir(u"..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
U16String sampleConvertingWorksheetToDifferentImageFormats = srcDir + u"sampleConvertingWorksheetToDifferentImageFormats.xlsx"; | |
// Create an empty workbook. | |
Workbook workbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Create image or print options object. | |
ImageOrPrintOptions imgOptions; | |
// Specify the image format. | |
imgOptions.SetImageType(ImageType::Tiff); | |
// Specify horizontal and vertical resolution | |
imgOptions.SetHorizontalResolution(200); | |
imgOptions.SetVerticalResolution(200); | |
// Render the sheet with respect to specified image or print options. | |
SheetRender sr(worksheet, imgOptions); | |
// Get the output image path. | |
U16String outputTiff = outDir + u"outputConvertingWorksheetToImageTiff.tiff"; | |
// Convert worksheet to tiff image. | |
sr.ToTiff(outputTiff); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
// Source directory path. | |
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\"); | |
// Output directory path. | |
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\"); | |
// Path of input Excel file. | |
StringPtr sampleConvertingWorksheetToDifferentImageFormats = srcDir->StringAppend(new String("sampleConvertingWorksheetToDifferentImageFormats.xlsx")); | |
// Create an empty workbook. | |
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertingWorksheetToDifferentImageFormats); | |
// Access first worksheet. | |
intrusive_ptr<Aspose::Cells::IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Create image or print options object. | |
intrusive_ptr<Aspose::Cells::Rendering::IImageOrPrintOptions> imgOptions = Factory::CreateIImageOrPrintOptions(); | |
// Specify the image format. | |
imgOptions->SetImageFormat(Aspose::Cells::Systems::Drawing::Imaging::ImageFormat::GetTiff()); | |
// Specify horizontal and vertical resolution | |
imgOptions->SetHorizontalResolution(200); | |
imgOptions->SetVerticalResolution(200); | |
// Render the sheet with respect to specified image or print options. | |
intrusive_ptr<Aspose::Cells::Rendering::ISheetRender> sr = Factory::CreateISheetRender(worksheet, imgOptions); | |
// Get the output image path. | |
StringPtr outputTiff = outDir->Append((StringPtr)new String("outputConvertingWorksheetToImageTiff.tiff")); | |
// Convert worksheet to tiff image. | |
sr->ToTiff(outputTiff); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir = u""; | |
//Specify load options, we want to load Numbers spreadsheet | |
LoadOptions opts(LoadFormat::Numbers); | |
//Load the Numbers spreadsheet in workbook with above load options | |
Workbook wb(dataDir + u"sampleNumbersByAppleInc.numbers", opts); | |
//Save the workbook to pdf format | |
wb.Save(dataDir + u"outputNumbersByAppleInc.pdf", SaveFormat::Pdf); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
U16String dataDir = u""; | |
// Create a sample workbook and add some data inside the first worksheet | |
Workbook workbook; | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
worksheet.GetCells().Get(u"P30").PutValue(u"This is sample data."); | |
// Save the workbook in memory stream | |
Vector<uint8_t> ms = workbook.SaveToStream(); | |
// Now load the workbook from memory stream with A5 paper size | |
LoadOptions opts(LoadFormat::Xlsx); | |
opts.SetPaperSize(PaperSizeType::PaperA5); | |
workbook = Workbook(ms, opts); | |
// Save the workbook in pdf format | |
workbook.Save(dataDir + u"LoadWorkbookWithPrinterSize-a5_out.pdf"); | |
// Now load the workbook again from memory stream with A3 paper size | |
opts = LoadOptions(LoadFormat::Xlsx); | |
opts.SetPaperSize(PaperSizeType::PaperA3); | |
workbook = Workbook(ms, opts); | |
// Save the workbook in pdf format | |
workbook.Save(dataDir + u"LoadWorkbookWithPrinterSize-a3_out.pdf"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
U16String text = u"This is a test"; | |
Workbook workbook; | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
Shape shape = worksheet.GetShapes().AddTextBox(1, 0, 1, 0, 30, 100); | |
shape.SetText(text); | |
shape = worksheet.GetShapes().AddRectangle(5, 0, 1, 0, 30, 100); | |
shape.SetText(text); | |
shape = worksheet.GetShapes().AddButton(9, 0, 1, 0, 30, 100); | |
shape.SetText(text); | |
shape = worksheet.GetShapes().AddOval(13, 0, 1, 0, 50, 100); | |
shape.SetText(text); | |
//Protect all shapes in a specified worksheet | |
shape.GetWorksheet().Protect(ProtectionType::Objects);//Protects the entire worksheet. | |
//or shape.Worksheet.Protect(ProtectionType::All);//Protects all shapes in the specified worksheet. | |
//or worksheet.Protect(ProtectionType::Objects);//Protects the entire worksheet. | |
//or worksheet.Protect(ProtectionType::All);//Protects all shapes in the specified worksheet. | |
workbook.Save(u"Locked.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
Workbook workbook(u"Locked.xlsx"); | |
//Get protected worksheet | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
//Get the specified shape to be unlocked | |
Shape shape = worksheet.GetShapes().Get(u"TextBox 1"); | |
//Unlock the specified shape | |
if (!worksheet.GetProtection().GetAllowEditingObject() && shape.IsLocked()) | |
{ | |
shape.SetIsLocked(false); | |
} | |
workbook.Save(u"UnLocked.xlsx", SaveFormat::Xlsx); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir = u""; | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions4(LoadFormat::Csv); | |
// Create a Workbook object and opening the file from its path | |
Workbook wbCSV(dataDir + u"Book_CSV.csv", loadOptions4); | |
std::cout << "CSV file opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Opening CSV Files | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_CSV); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.csv")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("CSV file opened successfully!")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory | |
U16String sourceDir = u""; | |
U16String filename = sourceDir + u"InvalidCharacters.csv"; | |
//Load CSV file | |
LoadFilter filter(LoadDataFilterOptions::CellData); | |
TxtLoadOptions csvOpt; | |
csvOpt.SetSeparator(';'); | |
csvOpt.SetLoadFilter(&filter); | |
csvOpt.SetCheckExcelRestriction(false); | |
csvOpt.SetConvertNumericData(false); | |
csvOpt.SetConvertDateTimeData(false); | |
Workbook workbook(filename, csvOpt); | |
std::cout << "CSV file opened successfully!" << std::endl; | |
// Save for check | |
workbook.Save(u"Output.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Opening CSV Files | |
// Instantiate LoadOptions specified by the LoadFormat. | |
intrusive_ptr <Aspose::Cells::ITxtLoadOptions> loadOptions = Factory::CreateITxtLoadOptions(LoadFormat::LoadFormat_CSV); | |
loadOptions->SetSeparator(';'); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("InvalidCharacters.csv")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("CSV file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir = u""; | |
// Opening Microsoft Excel 2007 Xlsx Files | |
LoadOptions loadOptions(LoadFormat::Xlsx); | |
// Create a Workbook object and opening the file from its path | |
Workbook wbExcel07(dataDir + u"Input.xlsx", loadOptions); | |
//Show following message on console | |
std::cout << "Microsoft Excel 2007 - Office365 workbook opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Opening Microsoft Excel 2007 Xlsx Files | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Xlsx); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> wbExcel07 = Factory::CreateIWorkbook(dataDir->StringAppend(new String("Input.xlsx")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("Microsoft Excel 2007 - Office365 workbook opened successfully!")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions(LoadFormat::Excel97To2003); | |
// Create a Workbook object and opening the file | |
Workbook wbExcel95(u"Excel95.xls", loadOptions); | |
//Show following message on console | |
std::cout << "Microsoft Excel 95/5.0 workbook opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// Get the Excel file into stream | |
intrusive_ptr<FileStream> fstream = new FileStream(new String("Excel95.xls"), FileMode_Open); | |
// Instantiate LoadOptions specified by the LoadFormat. | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Excel97To2003); | |
// Create a Workbook object and opening the file from the stream | |
intrusive_ptr<IWorkbook> wbExcel95 = Factory::CreateIWorkbook(fstream, loadOptions); | |
//Show following message on console | |
Console::WriteLine(new String("Microsoft Excel 95/5.0 workbook opened successfully!")); | |
//Close the Stream object | |
fstream->Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions(LoadFormat::Excel97To2003); | |
// Create a Workbook object and opening the file | |
Workbook wbExcel03(u"Excel03.xls", loadOptions); | |
//Show following message on console | |
std::cout << "Microsoft Excel 97 - 2003 workbook opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// Get the Excel file into stream | |
intrusive_ptr<FileStream> fstream = new FileStream(new String("Excel03.xls"), FileMode_Open); | |
// Instantiate LoadOptions specified by the LoadFormat. | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Excel97To2003); | |
// Create a Workbook object and opening the file from the stream | |
intrusive_ptr<IWorkbook> wbExcel03 = Factory::CreateIWorkbook(fstream, loadOptions); | |
//Show following message on console | |
Console::WriteLine(new String("Microsoft Excel 97 - 2003 workbook opened successfully!")); | |
//Close the Stream object | |
fstream->Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory | |
U16String sourceDir = u""; | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions(LoadFormat::Fods); | |
// Create a Workbook object and opening the file from its path | |
Workbook workbook(sourceDir + "SampleFods.fods", loadOptions); | |
// Show following message on console | |
std::cout << "FODS file opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Set LoadOptions | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_FODS); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.fods")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("FODS file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir(u""); | |
// Opening HTML Files | |
LoadOptions loadOptions(LoadFormat::Html); | |
// Create a Workbook object and opening the file from its path | |
Workbook workbook(dataDir + u"Input.html", loadOptions); | |
// Show following message on console | |
std::cout << "HTML file opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Opening HTML Files | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Html); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.html")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("HTML file opened successfully!")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir(u""); | |
// Opening XML Files | |
LoadOptions loadOptions(LoadFormat::Xml); | |
// Create a Workbook object and opening the file from its path | |
Workbook workbook(dataDir + u"Input.xml", loadOptions); | |
// Show following message on console | |
std::cout << "XML file opened successfully!" <<std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Opening XML Files | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Xml); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.xml")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("XML file opened successfully!")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory | |
U16String sourceDir = u""; | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions(LoadFormat::Sxc); | |
// Create a Workbook object and opening the file from its path | |
Workbook workbook(sourceDir + u"SampleSXC.sxc", loadOptions); | |
// Using the Sheet 1 in Workbook | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Accessing a cell using its name | |
Cell cell = worksheet.GetCells().Get(u"C3"); | |
std::cout << "Cell Name: " << cell.GetName().ToUtf8() << " Value: " << cell.GetStringValue().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Set LoadOptions | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_SXC); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.sxc")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("SXC file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir = u""; | |
// Opening Tab Delimited Files | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions5(LoadFormat::TabDelimited); | |
// Create a Workbook object and opening the file from its path | |
Workbook wbTabDelimited(dataDir + u"Book1TabDelimited.txt", loadOptions5); | |
// Show following message on console | |
std::cout << "TabDelimited file opened successfully!" << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Set LoadOptions | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_TabDelimited); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("TabDelimited.txt")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("TabDelimited file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
// The path to the documents directory. | |
U16String dataDir = u""; | |
U16String filePath = dataDir + u"CustomSeparator.txt"; | |
// Instantiate Text File's LoadOptions | |
TxtLoadOptions txtLoadOptions; | |
// Specify the separator | |
txtLoadOptions.SetSeparator(u','); | |
// Specify the encoding type | |
txtLoadOptions.SetEncoding(EncodingType::UTF8); | |
// Create a Workbook object and opening the file from its path | |
Workbook wb(filePath, txtLoadOptions); | |
// Save file | |
wb.Save(dataDir + u"output.xlsx"); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Set for TxtLoadOptions | |
intrusive_ptr <Aspose::Cells::ITxtLoadOptions> loadOptions = Factory::CreateITxtLoadOptions(); | |
loadOptions->SetSeparator(','); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("CustomSeparator.txt")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("TXT file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory | |
U16String sourceDir = u""; | |
// Instantiate LoadOptions specified by the LoadFormat. | |
LoadOptions loadOptions(LoadFormat::Tsv); | |
// Create a Workbook object and opening the file from its path | |
Workbook workbook(sourceDir + u"SampleTSVFile.tsv", loadOptions); | |
// Using the Sheet 1 in Workbook | |
Worksheet worksheet = workbook.GetWorksheets().Get(0); | |
// Accessing a cell using its name | |
Cell cell = worksheet.GetCells().Get(u"C3"); | |
std::cout << "Cell Name: " << cell.GetName().ToUtf8() << " Value: " << cell.GetStringValue().ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Aspose.Cells.h" | |
// The path to the documents directory. | |
StringPtr dataDir = new String(""); | |
// Set LoadOptions | |
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_TSV); | |
// Create a Workbook object and opening the file from its path | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook( | |
dataDir->StringAppend(new String("Input.tsv")), loadOptions); | |
// Show following message on console | |
Console::WriteLine(new String("TSV file opened successfully!")); | |
// Save for check | |
workbook->Save(new String("Output.xlsx")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath = u"..\\Data\\LoadingSavingForMetadata\\"; | |
//Paths of source and output excel files | |
U16String samplePath = dirPath + u"sample-metadata-properties.xlsx"; | |
//Load the sample excel file | |
Workbook wb(samplePath); | |
//Read built-in title and subject properties | |
U16String strTitle = wb.GetBuiltInDocumentProperties().GetTitle(); | |
U16String strSubject = wb.GetBuiltInDocumentProperties().GetSubject(); | |
std::cout << "Title: " << strTitle.ToUtf8() << std::endl; | |
std::cout << "Subject: " << strSubject.ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath = u"..\\Data\\LoadingSavingForMetadata\\"; | |
//Output directory path | |
U16String outPath = u"..\\Data\\Output\\"; | |
//Paths of source and output excel files | |
U16String samplePath = dirPath + u"sample-metadata-properties.xlsx"; | |
U16String outputPath = outPath + u"output-metadata-properties.xlsx"; | |
//Load the sample excel file | |
Workbook wb(samplePath); | |
//Modify built-in title and subject properties | |
U16String strTitle = u"Aspose.Cells New Title"; | |
U16String strSubject = u"Aspose.Cells New Subject"; | |
wb.GetBuiltInDocumentProperties().SetTitle(strTitle); | |
wb.GetBuiltInDocumentProperties().SetSubject(strSubject); | |
//Save the output excel file | |
wb.Save(outputPath); | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath = u"..\\Data\\LoadingSavingAndConverting\\"; | |
//Paths of source and output excel files | |
U16String samplePath = dirPath + u"sample-metadata-properties.xlsx"; | |
//Load the sample excel file | |
Workbook wb(samplePath); | |
//Read the custom property | |
U16String strCustomPropName = u"MyCustom1"; | |
U16String strCustomPropValue = wb.GetCustomDocumentProperties().Get(strCustomPropName).ToString(); | |
U16String myCustom1 = u"\r\nMyCustom1: "; | |
std::cout << myCustom1.ToUtf8() << strCustomPropValue.ToUtf8() << std::endl; | |
Aspose::Cells::Cleanup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose::Cells::Startup(); | |
U16String dataDir = u""; | |
//Specify the load options | |
LoadOptions opts; | |
LoadFilter filter(~LoadDataFilterOptions::DefinedNames); | |
//We do not want to load defined names | |
opts.SetLoadFilter(&filter); | |
//Load the workbook | |
Workbook wb = Workbook(dataDir + u"sampleFilterDefinedNamesWhileLoadingWorkbook.xlsx", opts); | |
//Save the output Excel file, it will break the formula in C1 | |
wb.Save(dataDir + u"outputFilterDefinedNamesWhileLoadingWorkbook.xlsx"); | |
Aspose::Cells::Cleanup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment