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

PDF Export

3 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 29 May 2009, 12:14 PM
I am exporting pdf files and was wondering if there was a way that if the cell is right aligned in the grid, to make it right align in the pdf file as well.  I created a custom control.  I have/will have over 200 reports. I want to be able to determine if the cell is right aligned or not other then 

            GridColumn col = (GridColumn)RadGrid1.MasterTableView.GetColumn("ColumnUniqueName"); 

where I would have to know each ColumnUniqueName.

3 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 29 May 2009, 03:16 PM
Hello Robert,

Try the following approach:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    if (e.Item is GridDataItem) 
    { 
        GridDataItem item = e.Item as GridDataItem; 
        string cstyle = ""
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            cstyle = col.ItemStyle.HorizontalAlign.ToString(); 
            item[col.UniqueName].Style["horizontal-align"] = cstyle == "NotSet" ? "" : cstyle.ToLower(); 
        } 
    } 

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
Robert
Top achievements
Rank 1
answered on 29 May 2009, 05:09 PM
Thanks, that works perfect.   But to right align it should be 
item[col.UniqueName].Style["text-align"] = cstyle == "NotSet" ? "" : cstyle.ToLower();
0
Daniel
Telerik team
answered on 30 May 2009, 11:49 AM
Hello Robert,

I'm glad that you found the correct approach. Excuse me if I my previous answer was confusing.

Let me know if you need more information.

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.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Robert
Top achievements
Rank 1
Share this question
or