SpreadsheetMerger.Process
Contents
[
Hide
]Process(string[], string)
Merge given template files.
public static void Process(string[] templateFiles, string resultFile)
| Parameter | Type | Description |
|---|---|---|
| templateFiles | String[] | The template files to be merged |
| resultFile | String | The resultant file |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.LowCode;
using System;
public class SpreadsheetMergerMethodProcessWithStringArrayStringDemo
{
public static void Run()
{
// Create sample template files
CreateTemplateFile("template1.xlsx", "Data from Template 1");
CreateTemplateFile("template2.xlsx", "Data from Template 2");
string[] templateFiles = { "template1.xlsx", "template2.xlsx" };
string resultFile = "merged_output.xlsx";
try
{
SpreadsheetMerger.Process(templateFiles, resultFile);
Console.WriteLine($"Process method merged {templateFiles.Length} files into {resultFile}");
}
catch (Exception ex)
{
Console.WriteLine($"Error executing Process method: {ex.Message}");
}
}
private static void CreateTemplateFile(string fileName, string cellValue)
{
Workbook workbook = new Workbook();
workbook.Worksheets[0].Cells["A1"].PutValue(cellValue);
workbook.Save(fileName);
}
}
}
See Also
- class SpreadsheetMerger
- namespace Aspose.Cells.LowCode
- assembly Aspose.Cells
Process(LowCodeMergeOptions)
Merges multiple template files into one.
public static void Process(LowCodeMergeOptions options)
| Parameter | Type | Description |
|---|---|---|
| options | LowCodeMergeOptions | Options for merging files |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.LowCode;
using System;
public class SpreadsheetMergerMethodProcessWithLowCodeMergeOptDemo
{
public static void Run()
{
// Prepare two simple template files that will be merged.
CreateTemplateFile("TemplateA.xlsx", "Data from Template A");
CreateTemplateFile("TemplateB.xlsx", "Data from Template B");
try
{
// Create an instance of the options class.
// The LowCodeMergeOptions class is part of Aspose.Cells.LowCode.
// For this demo we use the default constructor.
LowCodeMergeOptions options = new LowCodeMergeOptions();
// Call the Process method that accepts LowCodeMergeOptions.
SpreadsheetMerger.Process(options);
Console.WriteLine("Process method invoked successfully with LowCodeMergeOptions.");
}
catch (Exception ex)
{
Console.WriteLine($"Error executing Process: {ex.Message}");
}
}
private static void CreateTemplateFile(string fileName, string cellValue)
{
Workbook workbook = new Workbook();
workbook.Worksheets[0].Cells["A1"].PutValue(cellValue);
workbook.Save(fileName);
}
}
}
See Also
- class LowCodeMergeOptions
- class SpreadsheetMerger
- namespace Aspose.Cells.LowCode
- assembly Aspose.Cells