//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); workbook.Culture = CultureInfo.GetCultureInfo("ja-JP"); var sheet = workbook.ActiveSheet; sheet.Range["$A$1:$A$3"].Value = new[,] { {"Original"}, {"ゴールドシップは1番人気です。"}, {"Halfwidth"} }; sheet.Range["A5"].Value = "Fullwidth"; var a4 = sheet.Range["A4"]; var a6 = sheet.Range["A6"]; // Equivalent: Formula = "ASC(A2)" // Because ASC doesn't have localized name in Japanese Excel. a4.FormulaLocal = "=ASC(A2)"; // Equivalent: Formula = "DBCS(A2)" // Because JIS is localized name of DBCS in Japanese Excel. a6.FormulaLocal = "=JIS(A2)"; // Compare different formula properties. sheet.Range["$B$1:$F$1"].Value = new[,] { {nameof(IRange.FormulaLocal), nameof(IRange.Formula), nameof(IRange.FormulaR1C1Local), nameof(IRange.FormulaR1C1)} }; sheet.Range["$B$4:$E$4"].Value = new[,] { {a4.FormulaLocal, a4.Formula, a4.FormulaR1C1Local, a4.FormulaR1C1} }; sheet.Range["$B$6:$E$6"].Value = new[,] { {a6.FormulaLocal, a6.Formula, a6.FormulaR1C1Local, a6.FormulaR1C1} }; // Arrange layout sheet.UsedRange.Columns.AutoFit(); sheet.PageSetup.IsPercentScale = false; sheet.PageSetup.FitToPagesWide = 1; sheet.PageSetup.PrintHeadings = true; // Save to a pdf file workbook.Save("FormulaLocalAndJis.pdf");
' Create a new Workbook Dim workbook As New Workbook workbook.Culture = CultureInfo.GetCultureInfo("ja-JP") Dim sheet = workbook.ActiveSheet sheet.Range("$A$1:$A$3").Value = { {"Original"}, {"ゴールドシップは1番人気です。"}, {"Halfwidth"} } sheet.Range!A5.Value = "Fullwidth" Dim a4 = sheet.Range!A4 Dim a6 = sheet.Range!A6 ' Equivalent: Formula = "ASC(A2)" ' Because ASC doesn't have localized name in Japanese Excel. a4.FormulaLocal = "=ASC(A2)" ' Equivalent: Formula = "DBCS(A2)" ' Because JIS is localized name of DBCS in Japanese Excel. a6.FormulaLocal = "=JIS(A2)" ' Compare different formula properties. sheet.Range("$B$1:$F$1").Value = { {NameOf(IRange.FormulaLocal), NameOf(IRange.Formula), NameOf(IRange.FormulaR1C1Local), NameOf(IRange.FormulaR1C1)} } sheet.Range("$B$4:$E$4").Value = { {a4.FormulaLocal, a4.Formula, a4.FormulaR1C1Local, a4.FormulaR1C1} } sheet.Range("$B$6:$E$6").Value = { {a6.FormulaLocal, a6.Formula, a6.FormulaR1C1Local, a6.FormulaR1C1} } ' Arrange layout sheet.UsedRange.Columns.AutoFit() sheet.PageSetup.IsPercentScale = False sheet.PageSetup.FitToPagesWide = 1 sheet.PageSetup.PrintHeadings = True ' save to a pdf file workbook.Save("FormulaLocalAndJis.pdf")