نوشته شده توسط
mazoolagh
سلام دوباره
منظور از سیریلیک خط کشورهای مثل روسیه و ... هست که خودش زیرمجموعه یونیکد حساب میشه.
بعضی وقتها پیش میاد که کمپوننت ها با کارآکترهای فارسی/عربی مشکل دارن ولی با زیرمجموعه های دیگه نه (مثل همین سیریلیک، یا فرانسه، آلمانی، اسپانیایی و ...)
بعضی وقتها هم کلا با غیرانگلیسی مشکل دارن.
اسم کتابخانه هایی که تست کردین رو بدین - من هم سر فرصت تست میکنم.
یک جستجو هم همینجا انجام بدین. احتمال داره که پیشتر هم مطرح شده باشه.
سلام مجدد
با جستجو اون کد اولی رو یه خورده اصلاح کردم
private void ExportGridToPDF()
{
PdfPTable pdfTable = new PdfPTable(this.dgvCheckListForExport.HeaderRow.Cel ls.Count);
pdfTable.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
pdfTable.HorizontalAlignment = Element.ALIGN_CENTER;
pdfTable.WidthPercentage = 100;
var fontPath = Environment.CurrentDirectory + "\\fonts\\BNaznnBd.ttf";
var fontBase = BaseFont.CreateFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
var font = new iTextSharp.text.Font(fontBase, 10);
iTextSharp.text.Font Text = new iTextSharp.text.Font(fontBase, 10, iTextSharp.text.Font.NORMAL);
foreach (TableCell headrerCell in dgvCheckListForExport.HeaderRow.Cells)
{
font.Color = new BaseColor(this.dgvCheckListForExport.HeaderStyle.F oreColor);
PdfPCell pdfCell = new PdfPCell(new Phrase(headrerCell.Text, font));
pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
pdfCell.VerticalAlignment = Element.ALIGN_CENTER;
pdfCell.BackgroundColor = new BaseColor(this.dgvCheckListForExport.HeaderStyle.B ackColor);
pdfTable.AddCell(pdfCell);
}
foreach (GridViewRow gridViewRow in dgvCheckListForExport.Rows)
{
foreach(TableCell tableCell in gridViewRow.Cells)
{
font.Color = new BaseColor(this.dgvCheckListForExport.RowStyle.Fore Color);
PdfPCell pdfCell = new PdfPCell(new Phrase(tableCell.Text, font));
pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
pdfCell.VerticalAlignment = Element.ALIGN_CENTER;
pdfCell.BackgroundColor = new BaseColor(this.dgvCheckListForExport.RowStyle.Back Color);
pdfTable.AddCell(pdfCell);
}
}
Document pdfDocument = new Document(PageSize.A4, 10f, 10f, 10f, 10f);
PdfWriter.GetInstance(pdfDocument, Response.OutputStream);
pdfDocument.Open();
pdfDocument.Add(pdfTable);
pdfDocument.Close();
Response.ContentType = "application/pdf";
Response.AppendHeader("content-disposition", "attachment;filename=CheckListNosaziCode"+this.lbC ode.Text.Trim()+".pdf");
Response.Write(pdfDocument);
Response.Flush();
Response.End();
}
جالبه pdf میشه ولی سفید هست(طبق تصویر اولی). ولی وقتی همون pdf رو تبدیل به word می کنم اطلاعات رو نمایش میده همه چی هم درسته و فونت و سایر موارد!!