ITextSharp: Align cell while exporting GridView to PDF in ASP.Net

Last Reply 9 months ago By Codemat

Posted 9 months ago

Hello, I apologize if the topic has already been dealt with but I can not find a solution in this regard.
I am exporting a gridview with iTextSharp, as in this example:

The problem is that the output obtained is completely misaligned and not corresponding to what I see on the screen.

I protected everything, with css (text-align: center;), with ItemStyle-HorizontalAlign = "Left" in the templatefiled headers, but nothing, the text is not aligned.

tips? or alternatives?

best regards

You are viewing reply posted by: Codemat 9 months ago.
Posted 9 months ago Modified on 9 months ago

Hello pandeyism thank you for your time

For the moment I solved differently, that is changing the approach with the code.

Basically I build directly the table I need, through iTextSharp, cycling the datatable, as indicated by @Mudassar in this topic:

iTextSharp: How to convert HTML Table string to PDF using C# .Net

Thanks again