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

将具有图像和图表的工作簿合并

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

源工作簿

输出工作簿

屏幕截图

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

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

todo:image_alt_text

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

todo:image_alt_text

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

todo:image_alt_text

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

todo:image_alt_text

// 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);

高级主题