将多个工作簿合并为一个工作簿

将工作簿与图像和图表相结合

示例代码使用 Aspose.Cells 将两个工作簿组合成一个工作簿。代码加载源工作簿,使用工作簿.combine()组合它们并保存输出工作簿的方法。

源工作簿

输出工作簿

截图

以下是源工作簿和输出工作簿的屏幕截图。

图表工作簿的第一个工作表 - 堆叠

待办事项:图片_替代_文本

图表工作簿的第二个工作表 - 线

待办事项:图片_替代_文本

图片工作簿的第一个工作表——图片

待办事项:图片_替代_文本

组合工作簿中的所有三个工作表 - 堆叠、线条、图片

待办事项:图片_替代_文本

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Define the first source
// Open the first excel file.
Workbook SourceBook1 = new Workbook(dataDir+ "SampleChart.xlsx");
// Define the second source book.
// Open the second excel file.
Workbook SourceBook2 = new Workbook(dataDir+ "SampleImage.xlsx");
// Combining the two workbooks
SourceBook1.Combine(SourceBook2);
dataDir = dataDir + "Combined.out.xlsx";
// Save the target book file.
SourceBook1.Save(dataDir);

推进主题