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

[Solved] PDF Export Add/Modify

3 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tayonee
Top achievements
Rank 1
Tayonee asked on 07 Apr 2009, 01:30 AM
How do you add or modify an exported PDF.  I know how to set the property but cannot figure out how actually add data to the PDF or modify data in the PDF.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Apr 2009, 04:30 AM
Hello Tayonee,

It is possible to modify the data before exporting to PDF. See the example;

CS:
 
protected void Button1_Click(object sender, EventArgs e) 
{        
    foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
    { 
        if (item["CategoryID"].Text == "1"
        { 
            item["Description"].Text = "Modified"
        } 
    }            
    RadGrid1.ExportSettings.OpenInNewWindow = true
    RadGrid1.MasterTableView.ExportToPdf(); 

If you need additional data as title, then you can use Caption or CommandItemTemplate for that. Also refer the link for more information about Exporting tips and tricks

Thanks,
Shinu.
0
Tayonee
Top achievements
Rank 1
answered on 07 Apr 2009, 01:03 PM
Thanks for the response.  I cannot get the CommandItemTemplate working.  The text in the CommandItemTemplate region never shows up in the pdf.  Here is my code:

        <telerik:RadGrid ID="grdSearchResults" runat="server" AutoGenerateColumns="False" DataSourceID="sqlUserDetail"    AllowPaging="true" PageSize="20"
            GridLines="None" AllowMultiRowSelection="true" AllowSorting="true">
            <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="false">
                <Pdf AllowAdd="true" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"
                    Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" PageTopMargin="1in" PageTitle="Practicioner export document"
                    Subject="Practicioner Export" Title="Practicioner export" PaperSize="Letter" />
            </ExportSettings>            
            <HeaderContextMenu EnableTheming="True">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
            </HeaderContextMenu>

            <MasterTableView DataSourceID="sqlUserDetail" DataKeyNames="UserID">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                
                <CommandItemTemplate>
                    Test additional data
                </CommandItemTemplate>


Also how do you add data to the pdf (I'm guessing that is what the AllowAdd property is for).
0
Princy
Top achievements
Rank 2
answered on 08 Apr 2009, 04:24 AM
Hi Tayonee,

Have you set the CommandItemDisplay property to Top? If not try setting it as shown below.

ASPX:
 
<MasterTableView  CommandItemDisplay="Top" > 


Thanks
Princy
Tags
Grid
Asked by
Tayonee
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Tayonee
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or