画像またはチャートを含む XLS ファイルを PDF に変換します
Contents
[
Hide
]
Aspose.Cells は、画像とチャートを含む XLS ファイルの PDF ドキュメントへの変換をサポートします。 Aspose.Cells for .NET は独立してスプレッドシートを PDF に変換できます: Aspose.PDF for .NET は変換に必要ありません。プロセスは一時または中間の XML ファイルに依存しないため、プロセスはメモリ内で実行できます。これは、画像、チャート、その他の描画オブジェクトを含む大きな Excel ファイルをすばやく効率的に変換できることを意味します。
サンプルコード
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 documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
try | |
{ | |
// Get the template excel file path. | |
string designerFile = dataDir + "SampleInput.xls"; | |
// Specify the pdf file path. | |
string pdfFile = dataDir + "Output.out.pdf"; | |
// Open the template excel file | |
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(designerFile); | |
// Save the pdf file. | |
wb.Save(pdfFile, SaveFormat.Pdf); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(e.Message); | |
Console.ReadLine(); | |
} |
スプレッドシートに数式が含まれている場合は、Workbook.計算式メソッドを PDF にレンダリングする直前に実行します。これにより、式に依存する値が再計算され、正しい値が PDF にレンダリングされます。