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

Alignment in pdf

3 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 17 Mar 2009, 08:29 AM
Hi All

I have created a grid

I have fetched the values from a table.

I have kept a button (Export To Pdf)

While clicking the button the datas are fetched and it appears in the pdf.

Is there any possible way to change the alignment in the pdf.

Thanks in Advance

Regards,
Anto



3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Mar 2009, 09:15 AM
Hi Anto,

Give a try with the following code to align the the Grid contents in the exported pdf document.

CS:
bool isPdfExport = false
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == RadGrid.ExportToPdfCommandName) 
        { 
            isPdfExport = true
            RadGrid1.ExportSettings.IgnorePaging = true
        } 
    } 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (isPdfExport && e.Item is GridHeaderItem) 
        { 
            GridHeaderItem headerItem = (GridHeaderItem)e.Item; 
            headerItem.Style["font-size"] = "16pt"
            headerItem.Style["color"] = "red"
            headerItem.Style["background-color"] = "yellow"
            headerItem.Style["height"] = "50px"
            headerItem.Style["vertical-align"] = "bottom"
            headerItem.Style["horizontal-align"] = "center";  
            foreach (TableCell cell in headerItem.Cells) 
            { 
                cell.Style["text-align"] = "left"
                cell.Style["font-weight"] = "bold"
                cell.Style["border-color"] = "red"
            } 
        } 
    } 
 


Thanks
Shinu.
0
Accepted
Daniel
Telerik team
answered on 17 Mar 2009, 10:36 AM
Hello Anto,

I strongly recommend you examine the links shown below:
Export to Microsoft Excel/Word/PDF/CSV
Exporting tips and tricks

Best regards,
Daniel
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
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 17 Mar 2009, 11:46 AM
Hi Shinu and Daniel

I went through it. But how could I merge it with my coding

-Anto
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or