Export to pdf - wrap text

Hi,

I am using export pdf (java) functionality. I would like to know how can I wrap the text for column headers as well as for column cells.

I did try using the latest grid-to-pdf java version, also used mygrid.enableMultiline(true); code in my loadGrid() method, however the pdf was still not wrapping the text.

Please advise.

Thanks,
Sam

Hi,
you should modify method printColumn in file PDFWriter.java like here:

String label = textWrap(column.getName(), width - 2*cellOffset, f1);

Could you please provide the code or working example. I am not able to wrap the text into column header and cells.

Thanks,
Sam

Never mind, I figure out a way to fix it.

Thanks

Hi Radyno,

I was able to wrap text for column headers, however I would like to know how can wrap text for row cells.

For instance, row 1 has 13 columns, each column’s text length is less that its column width - so in this case text will appear fine, however in row 2 where couple of columns has text length which exceeds its column width they are truncated as text…(i.e. text truncated until text length is less than column’s width and it is printed as text…, i.e. with 3 dots)

I will really appreciate if you can help by providing a solution which can increase the row height of cell/column, where cell text length exceeds its column width and value is not truncated at all.

Please advise.

Thanks,
Sam

Hi,
unfortunately there is no way to do that for java.

We already built a big project using dhtmlxgrid and the users are loving it, however the text wrapping in pdf columns is now becoming a major concern as pdf’s are exchanged and sent along in emails for various purposes.

I read somewhere on the forum, that PHP export to pdf version takes care of wrapping text in the columns? Is that correct? Then why not java?

Will export to pdf(java) version include this enhancement in near future?

Thanks,
Sam

Hi,
yes, php version supports text wrapping. Unfortunately java-library for producing PDF (PDFJet) doesn’t provide some important methods for getting sizes and precalculating row height. So there is no way to do that in java for now.

Radyno,

I believe there should be note or some information on dhtmlxgrid pdf page that JAVA version of export to pdf does not supports text wrapping in column cells where as PHP does.

I hope you and dhtmlxgrid support should understand that there is NO USE of having a pdf if the text is truncated and not shown in the columns of pdf, this means the user has to come to webpage every time when he wants to read the description. Really frustrating.

May i please know when the fix will be ready for export to pdf java version???

Thanks,
Sam

Thanks for your feedback.
Unfortunately there is no way to implement text wrapping for now.
We will do it as soon as PDFJet will provide required functionality.

Hi,
Can you try increasing the page size to the width and height of the grid ? It may help.

In PDFXMlParser.java setXML method , add the bold lines to the code.

if (orientation_string != “”) {
if (orientation_string.equalsIgnoreCase(“landscape”)) {
orientation = A4.LANDSCAPE;
} else {
orientation = A4.PORTRAIT;
}
} else {
double sum_width = 0;
for (int i = 0; i < widths.length; i++)
sum_width += widths[i];
if (sum_width/widths.length < 80)
orientation = Letter.LANDSCAPE;
else
orientation = Letter.PORTRAIT;

//RA: changed the orientation when columns are too many.
orientation[0] = 1.2sum_width;
orientation[1] = 792
(orientation[0]/612);

}

It worked for me.

Good work!

I read the thread. I need to know, is there any feature to wrap the text in (Export->PDF) .NET version.

Hi Dhivya,
can you specify, what do you mean by wrapping the text?
You may also try latest version of export tool, to see if feature implemented there
s3.amazonaws.com/uploads.hipcha … 130208.zip

Hi,

I am able to export as PDF using the those libraries, which you have attached in the email. Is this wrapping the column values, for e.g. if the column value is more than 10 characters, its not wrapping, its hiding. I want to display those values with wrapping.

I used which you have sent, it is not wrapping the text. Please find the attachment for your reference.

hello,
unfortunatelly this feature is not implemented in current version

Ok Thanks for your reply!

Please get back to us once this feature is added.

ranan2 - Thanks for your inputs, it did help a bit for some of my grids, however the page zoom level becomes 45%. I know we can increase it and set as we want but when I want to print the pdf, it’s divided into 4 pages, i.e. I have 15 columns then 1st page will have 1-3 columns, 2nd page - 3-6, 3rd page - 6-9 and so on…

DHTMLX Support,

As of now, I have decided to implement export-to-pdf grid functionality using php, i.e. by using grid-pdf-php code and now text is being wrapped in columns, however how can I implement text wrapping in column HEADERS.

Please suggest.

Thanks,
Sam

I have also asked this question in http://forum.dhtmlx.com/viewtopic.php?f=23&t=31228, if anyone can help, then please reply to either of the two posts.

Thanks,
Sam