This is a migrated thread and some comments may be shown as answers.

Export to pdf text wrapping to fit page width issues and wrong output if column was not previously visible on screen

7 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wetzorke
Top achievements
Rank 1
Wetzorke asked on 23 Jan 2018, 09:46 AM

Hello,

I would like to export my RadGridView to Pdf using the PrintPreviewControl and RadSpreadsheet. To create the workbook I use the ExportToWorkbook method like so:

book = grid.ExportToWorkbook(new GridViewDocumentExportOptions()
{
    ShowColumnFooters = grid.ShowColumnFooters,
    ShowColumnHeaders = grid.ShowColumnHeaders,
    ShowGroupFooters = grid.ShowGroupFooters,
    AutoFitColumnsWidth = true,
    ExportDefaultStyles = true
});

and I style the cells like this:

CellStyle normalStyle = book.Styles["Normal"];
normalStyle.BottomBorder = cellBorder;
normalStyle.IsWrapped = true;
normalStyle.RightBorder = cellBorder;
foreach (Worksheet worksheet in book.Worksheets)
{
    CellRange used = worksheet.UsedCellRange;
    worksheet.Cells[1, used.FromIndex.ColumnIndex, used.ToIndex.RowIndex,
    used.ToIndex.ColumnIndex].SetStyleName("Normal");
}

 

This works fine until I have columns with very long text (with whitespaces) that won't fit on one line (neither portrait nor landscape orientation). I tried to use text wrapping on the cell style by setting the IsWrapped property to true, but this does not yield the desired result. Also "AutoFitColumnsWidth = true" does not seem to effect my columns either.

I also witnessed a strange behaviour concerning columns that are at the end of my GridView where I have to scroll to see them on screen.

When I show the PreviewControl before I scrolled to those columns, I get a different output than when I previously scrolled to those columns.

For better understanding, I attach three pictures of the results I get.

Any help would be appreciated.

Best regards

 

 

 

7 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 26 Jan 2018, 09:11 AM
Hello,

Currently I cannot relate this behavior to a known issue of RadGridView for WPF, or Telerik Document Processing. Would it be possible for you to send us a sample project that we can use to reproduce the problem on our side? 

Regards,
Ivan Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Jolanta
Top achievements
Rank 1
Veteran
answered on 12 May 2020, 10:58 AM
Hi, this topic was not continued till now, I have now a problem with wrong text wrapping in report exported to PDF.
In HTML viewer the wrapping is incorrectly too.
I use html viewer and engine for export to PDF under version 12.1.18.620.

In viewer running under SilverL: Q1 2013 SP1, the wrapping works perfectly.

Do you have any solution for that?
(see attached files)

Jola Krawczyk
0
Todor
Telerik team
answered on 15 May 2020, 07:32 AM

Hello Jola,

The question is related to Telerik Reporting.

Please, consider opening a new thread in the Reporting Forum. It will be very helpful if you sent us a runnable project that demonstrates the issue for local investigation.

Is the issue reproducible with our newer versions?

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jolanta
Top achievements
Rank 1
Veteran
answered on 15 May 2020, 09:51 AM
Thanks for answer. Currently we can't change to newer version.
This issue with rendering is independent of report construction.
Try just put my text (viewed in the examples) into simple textBox, you will have same effect.
The rendering in HTML viewer and PDF export works wrong in that version.
You can test it and if you see this bug and than change in newer version, please, just send me an info.

Jola K.
0
Todor
Telerik team
answered on 20 May 2020, 07:49 AM

Hello Jola,

I managed to reproduce the issue in the PDF export. The Html5 Viewer displayed the same report correctly. I tested with R2 2020 and with R2 2018 you have specified. The results were the same in both versions.

I have logged the issue on your behalf in our public feedback portal - The wrapping in PDF rendering is not correct. We have updated also your Telerik points as a token of gratitude.

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jolanta
Top achievements
Rank 1
Veteran
answered on 21 May 2020, 08:43 AM
Thank you very much!
By the way, as I recently wrote, SL viewer work corretly...
But: In viewer running under SilverL: Q1 2013 SP1
there is a problem with vertical rendering (but only in this viewer, in last reported html viewer and pdf export it works fine).

Issue: In your rendered text - multiline text, you have last line empty.
Then, the first line will be cut at the top. Removing the empty line - rendering is correct.
Maybe soon SL viewer will not be used commonly, but you could test it just for an info for you.
(I workarrounded it just with .trim() function just for my case).

Jola
0
Todor
Telerik team
answered on 26 May 2020, 08:08 AM

Hi Jola,

Thank you for sharing this observation. The report is displayed in the Silverlight Report Viewer in XAML (for physical paging) or XAMLInteractive (Interactive mode) format - see Rendering Extensions. The formats are specific for the Silverlight viewer.

I tested to display a multiline text with one or two empty lines at the end in a TextBox in our latest Silverlight demo. The issue was not reproduced, so I assume it is related to the older version that you use. You may try to upgrade the Reporting tool to see whether this will fix the issue.

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
GridView
Asked by
Wetzorke
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jolanta
Top achievements
Rank 1
Veteran
Todor
Telerik team
Share this question
or