Node.jsを使ったC++経由での日付を日本の日付に変換する
Contents
[
Hide
]
日本のカレンダーでは、新しい天皇の即位とともに新しい元号が始まります。2019年5月1日に新しい天皇が即位し、平成時代が終了し令和時代が始まりました。
Aspose.Cellsは、西暦日付を日本の元号に変換する方法を提供します。この変換では、元号の変化も考慮されます。次のコードスニペットは、西暦日付を含む源のExcelファイルを日本の和暦付きの出力PDFに変換します。画像の例も示します。
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// Source directory
const sourceDir = path.join(__dirname, "data");
// Output directory
const outputDir = path.join(__dirname, "output");
const options = new AsposeCells.LoadOptions(AsposeCells.LoadFormat.Xlsx);
options.setLanguageCode(AsposeCells.CountryCode.Japan);
options.setRegion(AsposeCells.CountryCode.Japan);
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "JapaneseDates.xlsx"), options);
workbook.save(outputDir + "JapaneseDates.pdf", AsposeCells.SaveFormat.Pdf);