Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to resolve empty boxes problem for export if characters are japanese?

In our project, we are using Vs.net2008 and CrystalReport2008 component to develop reporting func. The datasource is using Pull Mode. It's Access 2003 (support unicode).

The problem here is that while exporting data contains Japanese characters to PDF/XLS/Doc, they are all displayed as empty boxes. After some search thru internet, it seems CR only support Unicode on some special Font. So we tried to set the font to ""MS UI Gothic" dynamically in .Net code, that indeeds solve the empty boxes problem. But our customers are unsatisified about that change because it makes the report looks ugly. (font is inconsistent).

Is there a better way to handle this?

The code I used is as follows:

private static void SetReportObjectFont(ReportDocument rd)

{

// modify field font to "MS UI Gothic" to solve problems of only show the empty boxes instead of japanese characters while exporting

foreach (ReportObject obj in rd.ReportDefinition.ReportObjects)

{

FieldObject field = obj as FieldObject;

if (field != null)

{

if (field.DataSource != null)

{

if (field.DataSource.ValueType == FieldValueType.PersistentMemoField || field.DataSource.ValueType == FieldValueType.StringField)

{

if (field.Font != null)

{

System.Drawing.Font ft = new System.Drawing.Font("MS UI Gothic", field.Font.Size, field.Font.Style, field.Font.Unit, field.Font.GdiCharSet, field.Font.GdiVerticalFont);

try

{

field.ApplyFont(ft);

}

catch { }

}

}

}

}

}

}

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question