ワークブックのレンダリング用に個別またはプライベートのフォント セットを指定する
Contents
[
Hide
]
考えられる使用シナリオ
通常、すべてのワークブックに対してフォント ディレクトリまたはフォントのリストを指定しますが、ワークブックに対して個別のフォント セットまたはプライベート フォント セットを指定する必要がある場合もあります。 Aspose.Cells提供個々のフォント構成ワークブックのフォントの個別またはプライベート セットを指定するために使用できるクラス。
ワークブックのレンダリング用に個別またはプライベートのフォント セットを指定する
次のサンプル コードは、サンプル Excel ファイルを使用して指定された個々のまたはプライベートなフォントのセットで個々のフォント構成クラス。をご覧くださいサンプルフォントコード内だけでなく、出力 PDFそれによって生成されます。次のスクリーンショットは、フォントが正常に見つかった場合の出力 PDF がどのように見えるかを示しています。
サンプルコード
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-Java | |
// Path of your custom font directory. | |
String customFontsDir = "C:\\TempDir\\CustomFonts"; | |
// Specify individual font configs custom font directory. | |
IndividualFontConfigs fontConfigs = new IndividualFontConfigs(); | |
// If you comment this line or if custom font directory is wrong or | |
// if it does not contain required font then output pdf will not be rendered correctly. | |
fontConfigs.setFontFolder(customFontsDir, false); | |
// Specify load options with font configs. | |
LoadOptions opts = new LoadOptions(LoadFormat.XLSX); | |
opts.setFontConfigs(fontConfigs); | |
// Load the sample Excel file with individual font configs. | |
Workbook wb = new Workbook("sampleSpecifyIndividualOrPrivateSetOfFontsForWorkbookRendering.xlsx", opts); | |
// Save to PDF format. | |
wb.save("outputSpecifyIndividualOrPrivateSetOfFontsForWorkbookRendering.pdf", SaveFormat.PDF); |