複数のワークブックを単一のワークブックに結合する

画像とグラフを使用したワークブックの結合

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

ソースワークブック

出力ワークブック

スクリーンショット

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

チャートワークブックの最初のワークシート - 積み重ね

todo:image_alt_text

チャートワークブックの2番目のワークシート - 折れ線

todo:image_alt_text

画像ワークブックの最初のワークシート - 画像

todo:image_alt_text

結合されたワークブックの3つのワークシート - 積み重ね、折れ線、画像

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

高度なトピック