Node.js kullanarak Çalışma Kitabı Render ı için Bireysel veya Özel Yazı Tipleri Seti Belirleme

Olası Kullanım Senaryoları

Genellikle, tüm çalışma kitapları için yazı tipi dizini veya listesi belirlenir; fakat bazen, çalışma kitaplarınız için bireysel veya özel yazı tipi setleri belirlemeniz gerekebilir. Aspose.Cells for Node.js via C++, çalışma kitabınız için bireysel veya özel yazı tipi setlerini belirlemek için kullanılabilecek IndividualFontConfigs sınıfını sağlar.

Çalışma Kitabı Rendeleme İçin Bireysel veya Özel Font Kümesini Belirtin

Aşağıdaki örnek kod, belirtilen bireysel veya özel yazı tipi setleriyle örnek Excel dosyasını yükler. Kod içindeki örnek font ve üretilen çıktı PDF’si ile ilgili bilgileri görebilirsiniz. Bu ekran görüntüsü, yazı tipi başarıyla bulunduğunda çıktı PDF’sinin nasıl göründüğünü gösterir.

todo:image_alt_text

Örnek Kod

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// Path of your custom font directory.
const customFontsDir = "C:\\TempDir\\CustomFonts";

// Specify individual font configs custom font directory.
const fontConfigs = new AsposeCells.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.
const opts = new AsposeCells.LoadOptions(AsposeCells.LoadFormat.Xlsx);
opts.setFontConfigs(fontConfigs);

const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sampleSpecifyIndividualOrPrivateSetOfFontsForWorkbookRendering.xlsx");
// Output directory
const outputDir = path.join(__dirname, "output");
// Load the sample Excel file with individual font configs. 
const wb = new AsposeCells.Workbook(filePath, opts);

// Save to PDF format.
wb.save(outputDir + "outputSpecifyIndividualOrPrivateSetOfFontsForWorkbookRendering.pdf", AsposeCells.SaveFormat.Pdf);