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

Columns in PDF document enlarged on exporting data from radGrid

4 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 25 Oct 2010, 01:24 PM
I'm trying to export data using radgrid, it works fine for word, csv and excel. But when I try exporting to  dpf document, data is not formatted as it appears on the radgrid and yet for the other formats, are OK. In pdf, the column get resized and come out larger than they appear on the grid and thus they dont fit in A4 page on landscape even when they should.

How can I ensure the pdf document appear like data displayed on the grid? (i.e. columns in pdf are the same like the fixed columns i have set on radgrid). It works for other formats.

I have attached two sample docs that I get after exporting data:

1. Word-All columns appear.jpg: It shows a sample document exported to "word" and all columns are visible and well formatted.
2. PDF-cut of columns.jpg: Shows a sample document exported to "pdf" only a few columns are visible. The columns widths have been enlarged such that it cannot fit in the A4 page.

How can I fix this?

4 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 26 Oct 2010, 03:49 PM
Fixed it.
0
bharat veer
Top achievements
Rank 1
answered on 16 Apr 2011, 12:20 PM
hi Brother,
same problem i m facing.
all columns are not being exported and they get enlarged on the pdf.


how did you fix that.
please reply soon.

Thanks.
0
Tim
Top achievements
Rank 1
answered on 17 May 2011, 04:38 PM
Glad you fixed it. How about letting the rest of us know how.
0
Andrew
Top achievements
Rank 1
answered on 18 May 2011, 09:12 AM
Hi sorry for not replying earlier.

I used a hack to fix the problem.

I changed page width and height, margin left and right  when exporting to pdf. The code (i.e. C#) that i used is as follows:

 case RadGrid.ExportToPdfCommandName:
                    SetPdfExportSettings();
                    tableView.ExportToPdf();


        private void SetPdfExportSettings()
        {
            ContentRadGrid.ClientSettings.Scrolling.AllowScroll = false;
            ContentRadGrid.ClientSettings.Scrolling.UseStaticHeaders = false;
     
            ////// needs extra formatting work
            ContentRadGrid.ExportSettings.Pdf.PageWidth = new Unit(800, UnitType.Mm);
            ContentRadGrid.ExportSettings.Pdf.PageHeight = new Unit(600, UnitType.Mm);

            ContentRadGrid.ExportSettings.Pdf.AllowAdd = true;
            ContentRadGrid.ExportSettings.Pdf.AllowModify = true;
            ContentRadGrid.ExportSettings.Pdf.AllowPrinting = true;

            // Margins
            ContentRadGrid.ExportSettings.Pdf.PageLeftMargin = new Unit(15, UnitType.Mm);
            ContentRadGrid.ExportSettings.Pdf.PageRightMargin = new Unit(0);
        }


The above code worked for me.

NB: It may not be the most elegant way.

Thanks

Andrew
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
bharat veer
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or