Skip to content

Commit 139bd08

Browse files
committed
Add Merge Spreadsheet examples.
1 parent bda5766 commit 139bd08

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
public static class Example_MergeSpreadsheet
2+
{
3+
public static void Run()
4+
{
5+
MergedLocalFiles();
6+
MergeRemoteSpreadsheet();
7+
}
8+
9+
private static void MergedLocalFiles()
10+
{
11+
// Get your Client ID and Client Secret from https://dashboard.aspose.cloud (free registration is required).
12+
var cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(System.Environment.GetEnvironmentVariable("ProductClientId"), System.Environment.GetEnvironmentVariable("ProductClientSecret"));
13+
// Build merge request parameters
14+
var request = new Aspose.Cells.Cloud.SDK.Request.MergeSpreadsheetsRequest();
15+
IDictionary<string, System.IO.Stream> mapFiles = new Dictionary<string, System.IO.Stream>();
16+
mapFiles.Add("Book1.xlsx", File.OpenRead(@"c:\testdata\Book1.xlsx"));
17+
mapFiles.Add("Book2.xlsx", File.OpenRead(@"c:\testdata\Book2.xlsx"));
18+
request.Spreadsheet = mapFiles;
19+
request.outFormat = "pdf";
20+
cellsApi.MergeSpreadsheets(request, "MergedResultFile.pdf");
21+
}
22+
23+
private static void MergeRemoteSpreadsheet()
24+
{
25+
// Get your Client ID and Client Secret from https://dashboard.aspose.cloud (free registration is required).
26+
var cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(System.Environment.GetEnvironmentVariable("ProductClientId"), System.Environment.GetEnvironmentVariable("ProductClientSecret"));
27+
// Build merge request parameters
28+
var request = new Aspose.Cells.Cloud.SDK.Request.MergeRemoteSpreadsheetRequest();
29+
30+
request.name = "Book1.xlsx";
31+
request.folder = "RemoteFolder1";
32+
request.mergedSpreadsheet = "RemoteFolder2/Book2.xlsx";
33+
request.outFormat = "pdf";
34+
cellsApi.MergeRemoteSpreadsheet(request, "MergedResultOutPutToLocalFile.pdf");
35+
}
36+
}

0 commit comments

Comments
 (0)