複数のワークブックを 1 つのワークブックに結合する

ワークブックと画像およびチャートの結合

サンプル コードは、Aspose.Cells を使用して 2 つのワークブックを 1 つのワークブックに結合します。コードはソース ワークブックをロードし、Workbook.combine()メソッドを使用してそれらを結合し、出力ワークブックを保存します。

ソース ワークブック

出力ワークブック

スクリーンショット

以下は、ソース ワークブックと出力ワークブックのスクリーンショットです。

グラフ ワークブックの最初のワークシート - 積み上げ

todo:画像_代替_文章

グラフ ワークブックの 2 番目のワークシート - 線

todo:画像_代替_文章

ピクチャ ワークブックの最初のワークシート - ピクチャ

todo:画像_代替_文章

結合されたブック内の 3 つのワークシートすべて - 積み上げ、線、画像

todo:画像_代替_文章

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

先行トピック