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

how to inject custom data into pdf file while exporting radgrid to Pdf?

9 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 19 Feb 2009, 10:36 AM
Hi

I am exporting radGrid data to Pdf format, So while exporting I want to inject my own data ( custom data) into the pdf file.

How can  I achieve this?


Thanks,

9 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 19 Feb 2009, 10:48 AM
Hello Ram,

Go through the section 'Including additional information as part of the exported document' of the following document which explains on using CommandItemTemplate for including additional details as part of the exported content.
Exporting tips and tricks

Thanks
Princy.
0
Ram
Top achievements
Rank 1
answered on 19 Feb 2009, 11:40 AM
Thanks for the reply,

ya tried that already....but I am unable to inject  data(may be I am implementing in a wrong way)
here what exactly the details are and how the CommandItemTemplate is invoked ?
<CommandItemTemplate> 
     [Add your details here] 
  </CommandItemTemplate> 
can you provide any sample code.

and one more thing if there are more number of columns (say > 10) in my radGrid after exporting to pdf the data is overlapping in Pdf file,
so how can I adjust the data to be displayed in the page with out ovelapping of column data or is there any criteria that i can export only limited number of columns.

Thanks,
0
Accepted
Shinu
Top achievements
Rank 1
answered on 19 Feb 2009, 12:29 PM
Hi Ram,

Have you set the CommandItemDisplay property? If not try setting it as shown below and see whether you are able to include additional data in the CommandItemTemplate.

ASPX:
  
 
<MasterTableView  CommandItemDisplay="top"    > 

Also try setting the PageWidth for the PDF and see whether the exported data is overlapping each other.

ASPX:
 
 
<ExportSettings Pdf-PageWidth="1500"  ></ExportSettings


Thanks
Shinu
0
Ram
Top achievements
Rank 1
answered on 20 Feb 2009, 08:05 AM
Thanks Shinu,

Now I am able to display the columns with out overlapping.

But my data inject problem not solved.
0
Accepted
Shinu
Top achievements
Rank 1
answered on 20 Feb 2009, 08:50 AM
Hi Ram,

I used  CommandItemTemplate to display additional data and I am able to see it in the exported document as well. Make sure that you have set ExportOnlyData to false in the Click event of the Export button.

CS:
 
protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.ExportSettings.ExportOnlyData = false
        RadGrid1.MasterTableView.ExportToPdf(); 
    } 


Thanks
Shinu



0
Ram
Top achievements
Rank 1
answered on 20 Feb 2009, 10:10 AM
Thanks it is resolved now

but to make it work I had to add CommandItemDisplay="Top"

<mastertableview CommandItemDisplay="Top">


because of this only earlier it was not working
0
Le
Top achievements
Rank 1
answered on 11 May 2009, 08:24 AM

In exporting to PDF,I got that error when i set ExportOnlyData = false;

System.SystemException: Error while creating area : Encountered web exception while fetching image from file:///D:/Working/rptProject/ui: Access to the path 'D:\Working\rptProject\ui' is denied.
  at Telerik.Web.Apoc.ApocDriver.FireApocError(String message)
  at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

0
Georgi Krustev
Telerik team
answered on 12 May 2009, 11:39 AM
Hello Le,

Unfortunately I could not reproduce this issue. I created a test project in my attempt to recreate the abnormality explained so far. I used the latest official build of RadControls.
Please examine it and tell me if I am missing something.

Best wishes,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Derrick
Top achievements
Rank 1
answered on 20 Apr 2012, 05:40 PM
I think that exception is permissions related because I cannot reproduce it on my local development box, but when I copy my code to the test server it starts happening.
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Ram
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Le
Top achievements
Rank 1
Georgi Krustev
Telerik team
Derrick
Top achievements
Rank 1
Share this question
or