// Create a new workbook Workbook workbook = new Workbook(); workbook.setCulture(Locale.JAPAN); IWorksheet sheet = workbook.getActiveSheet(); sheet.getRange("$A$1:$A$3").setValue(new String[][] { { "Original" }, { "ゴールドシップは1番人気です。" }, { "Halfwidth" } }); sheet.getRange("A5").setValue("Fullwidth"); IRange a4 = sheet.getRange("A4"); IRange a6 = sheet.getRange("A6"); // Equivalent: Formula = "ASC(A2)" // Because ASC doesn't have localized name in Japanese Excel. a4.setFormulaLocal("=ASC(A2)"); // Equivalent: Formula = "DBCS(A2)" // Because JIS is localized name of DBCS in Japanese Excel. a6.setFormulaLocal("=JIS(A2)"); // Compare different formula properties. sheet.getRange("$B$1:$F$1") .setValue(new String[][] { { "FormulaLocal", "Formula", "FormulaR1C1Local", "FormulaR1C1" } }); sheet.getRange("$B$4:$E$4").setValue(new Object[][] { { a4.getFormulaLocal(), a4.getFormula(), a4.getFormulaR1C1Local(), a4.getFormulaR1C1() } }); sheet.getRange("$B$6:$E$6").setValue(new Object[][] { { a6.getFormulaLocal(), a6.getFormula(), a6.getFormulaR1C1Local(), a6.getFormulaR1C1() } }); // Arrange layout sheet.getUsedRange().getColumns().autoFit(); sheet.getPageSetup().setIsPercentScale(false); sheet.getPageSetup().setFitToPagesWide(1); sheet.getPageSetup().setPrintHeadings(true); // Save to a pdf file workbook.save("FormulaLocalAndJis.pdf");