クエリテーブルデータソースを持つテーブルの読み書き
Contents
[
Hide
]
クエリテーブルデータソースを持つテーブルの読み書き
Aspose.Cellsを使用すると、データソースとしてクエリテーブルを持つテーブルを読み込み、書き込むことができます。この機能はXLSファイルにも存在します。以下のコードスニペットは、まずテーブルを読み込み、その後変更して合計行を追加する方法を示しています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the source directory. | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Load workbook object | |
Workbook workbook = new Workbook(sourceDir + "SampleTableWithQueryTable.xls"); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
ListObject table = worksheet.ListObjects[0]; | |
// Check the data source type if it is query table | |
if (table.DataSourceType == TableDataSourceType.QueryTable) | |
{ | |
table.ShowTotals = true; | |
} | |
// Save the file | |
workbook.Save(outputDir + "SampleTableWithQueryTable_out.xls"); |
ソースエクセルファイルと出力エクセルファイルが添付されています。