Hi
I have a problem in a font change when save PDF.
Please see the attached file.(Meiryo => Gothic)
I tried the [1], [2], but I was no good
[1]
CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
CultureInfo currentUICulture=Thread.CurrentThread.CurrentUICulture;
Thread.CurrentThread.CurrentCulture =new CultureInfo("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Workbook test = OpenWorkBook(@"C:\FontConvertTest.xlsx");
test.Save(@"C:\fontTest.pdf", SaveFormat.Pdf);
[2] Convert Font Name ( jp -> eu)
Workbook test = OpenWorkBook(@"C:\FontConvertTest.xlsx");
#region <>
Worksheet sheet = test.Worksheets[0];
//Get:InstalledFontCollectionObject
System.Drawing.Text.InstalledFontCollection ifc =
new System.Drawing.Text.InstalledFontCollection();
FontFamily[] ffs = ifc.Families;
// Get:US Culture ID
int cultureId = System.Globalization.CultureInfo.GetCultureInfo("en-us").LCID;
int jcultureId = System.Globalization.CultureInfo.GetCultureInfo("ja-JP").LCID;
int maxRow = sheet.Cells.MaxDataRow;
int maxColumn = sheet.Cells.MaxDataColumn;
for (int x = 0; x < maxRow; x++)
{
for (int y = 0; y < maxColumn; y++)
{
FontSetting[] fss = sheet.Cells[x, y].GetCharacters();
if (fss != null)
{
foreach (FontSetting fs in fss)
{
string name = fs.Font.Name;
foreach (FontFamily fm in ffs)
{
if (name == fm.GetName(jcultureId))
{
fs.Font.Name = fm.GetName(cultureId);
}
}
}
}
Style style = sheet.Cells[x, y].GetStyle();
if (style != null && style.Font != null)
{
string name = style.Font.Name;
foreach (FontFamily fm in ffs)
{
if (name == fm.GetName(jcultureId))
{
name = fm.GetName(cultureId);
}
}
style.Font.Name = name;
}
sheet.Cells[x, y].SetStyle(style);
}
}
#endregion
test.Save(@"C:\fontTest.pdf", SaveFormat.Pdf);
---------
Installed ASPOSE.CELL Version: 8.1.0.0
Test Solution: VS 2012
Japan Windows7 64bit