asp.net - Gridview column width changes when converting to pdf using itextsharp -


good day !

before converting gridview pdf can modify font size , color using:

gridview.headerrow.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.headerrow.style.add("font-size", "7.20px"); gridview.headerrow.style.add("color", "#284775"); gridview.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.style.add("font-size", "6px"); 

the gridview has different column widths because of information being displayed, sizes set .aspx file. but, generated pdf file auto adjusts width of each column same size, therefore information shrinked , doesnt good..

i tried following:

gridview.width =100;  gridview.style.add("width","100"); 

and many more haven't been able adjust gridview it's original columns width.

how can that?

thanks in advance.

edit: i've tried:

gridview.columns[3].itemstyle.width =unit.pixel(10); 

this code use generate pdf file:

stringwriter stw = new stringwriter(); htmltextwriter htextw = new htmltextwriter(stw); gridview.headerrow.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.headerrow.style.add("font-size", "8.20px"); gridview.headerrow.style.add("color", "#284775"); gridview.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.style.add("font-size", "8px"); gridview.columns[3].itemstyle.width =unit.pixel(10); gridview.rendercontrol(htextw); document document = new document(itextsharp.text.pagesize.letter.rotate(), 10, 10, 42, 35); string path = "path im saving file".pdf"; pdfwriter writer = pdfwriter.getinstance(document, new filestream(path, filemode.create));             stringreader str = new stringreader(stw.tostring()); itextsharp.text.html.simpleparser.htmlworker htmlworker = new htmlworker(document); htmlworker.parse(str); response.write(document); document.close(); 

edit: found this link while searching , need, i'm getting following error when creating table :

the type or namespace name 'table' not exist in namespace 'itextsharp.text' 

and added itextsharp references. maybe version problem?


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -