I'm doing a proof of concept to test the ability to do this. I tweaked the "SimpleTable-VS2010" demo code as follows. I did change the font from Arial to Arial Unicode MS and set Unicode to true when creating the font.
I can use the same font outside of the table and it works just fine, but it doesn't appear to work inside of the table.
- Code: Select all
//title
PdfBrush brush1 = PdfBrushes.Black;
PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial Unicode MS", 16f, FontStyle.Regular), true);
PdfStringFormat format1 = new PdfStringFormat(PdfTextAlignment.Center);
page.Canvas.DrawString("Список стран", font1, brush1, page.Canvas.ClientSize.Width / 2, y, format1);
y = y + font1.MeasureString("Список стран", format1).Height;
y = y + 5;
String[] data
= {
"Name;Capital;Continent;Area;Population",
"Hello World;en;Hello World;912047;19700000",
"こんにちは世界;jp;世界;912047;19700000",
"你好世界;zh;你好世界;176140;3002000",
"привет мир;ru;привет мир;176140;3002000"
};
String[][] dataSource
= new String[data.Length][];
for (int i = 0; i < data.Length; i++)
{
dataSource[i] = data[i].Split(';');
}
PdfTable table = new PdfTable();
table.Style.CellPadding = 2;
table.Style.HeaderSource = PdfHeaderSource.Rows;
table.Style.HeaderRowCount = 1;
table.Style.ShowHeader = true;
table.DataSource = dataSource;
table.Style.DefaultStyle.Font = font1;
PdfLayoutResult result = table.Draw(page, new PointF(0, y));