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

Align Column headers for Export to PDF

2 Answers 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 05 Feb 2009, 04:19 PM
I'm using the Rad Grid's ExportToPDF functionality but I'm having trouble getting the column headers aligned properly.
I'm talking about the alignment of these headers in the saved PDF document. The are shifted to the right currently.

GRID:

<rad:RadGrid ID="activityLogListRadGrid" AllowPaging="True" AllowSorting="true" GridLines="Horizontal" 
    HorizontalAlign="Center" ShowFooter="true" ShowStatusBar="true" 
    EnableAJAX="True" EnableAJAXLoadingTemplate="True" LoadingTemplateTransparency="25" 
    Skin="Grid" SkinsPath="~/App_Themes/VertexDefault" 
            PageSize="18" AutoGenerateColumns="False" OnItemDataBound="activityLogListRadGrid_ItemDataBound" 
    OnSortCommand="activityLogListRadGrid_SortCommand" 
            OnNeedDataSource="activityLogListRadGrid_NeedDataSource" OnItemCommand="activityLogListRadGrid_ItemCommand" runat="server" > 
            <SortingSettings SortToolTip="Click to sort" /> 
                <ExportSettings IgnorePaging="true" OpenInNewWindow="true"
                            <Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous" 
            Keywords="None" PageWidth="1000" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" 
            PageTopMargin="1in" PageTitle="Activity Log Detail" 
            Subject="RadGrid Export" Title="Activity Log Detail" PaperSize="Letter" /> 
        </ExportSettings> 
        <PagerStyle AlwaysVisible="true" Height="25px" Mode="NumericPages" Position="Bottom" /> 
                        <MasterTableView DataKeyNames="CustomerID,CreateUserID,CreateDateTime" 
            TableLayout="Auto" AllowNaturalSort="false" Style="border: 0px solid #eaf2fd;" BorderColor="Black"
                            <SortExpressions> 
                                <rad:GridSortExpression FieldName="CreateDateTime" SortOrder="Ascending" /> 
                            </SortExpressions> 
                            <Columns> 
                                <rad:GridBoundColumn HeaderStyle-Width="200px" DataField="CreateDateTime" HeaderText="Activity Date" SortExpression="CreateDateTime" 
                                        UniqueName="CreateDateTime" DataFormatString="{0:MM/dd/yyyy}" ItemStyle-Wrap="False" /> 
                                <rad:GridHyperLinkColumn HeaderStyle-Width="200px" DataTextField="EventName" DataNavigateUrlFields="EventID" 
                                        DataNavigateUrlFormatString="~\Returns\ActivityLogDetail.aspx?EventID={0}" HeaderText="Event Name" SortExpression="EventName" UniqueName="EventName" /> 
                                <rad:GridBoundColumn HeaderStyle-Width="200px" DataField="LastNameFirstName" HeaderText="User" SortExpression="LastNameFirstName" 
                                        UniqueName="LastNameFirstName" ItemStyle-Wrap="False" /> 
                                <rad:GridHyperLinkColumn HeaderStyle-Width="215px" DataTextField="CustomerName" DataNavigateUrlFields="EventID" 
                                        DataNavigateUrlFormatString="~\Returns\ActivityLogDetail.aspx?EventID={0}" HeaderText="Customer" SortExpression="CustomerName" UniqueName="CustomerName" /> 
                            </Columns> 
                            <PagerTemplate> 
                <vtx:GridPager ID="gridPagerControl" runat="server" /> 
            </PagerTemplate> 
                        </MasterTableView> 
</rad:RadGrid> 

Button Click that triggers ExportToPDF:

protected void pdfExportButton_Click(object sender, EventArgs e) 
        { 
            log.Debug("pdfExportButton_Click"); 
 
            activityLogListRadGrid.ExportSettings.IgnorePaging = true
            activityLogListRadGrid.ExportSettings.OpenInNewWindow = true
 
            activityLogListRadGrid.MasterTableView.ExportToPdf(); 
        } 
 
 
 


Any advice on getting the column headers properly aligned would be much appreciated.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Feb 2009, 05:22 AM
Hi Julian,

Go through the following help article which explains on the exporting tips and tricks. Refer the topic RadGrid formatting and PDF export in the article.
Exporting tips and tricks

Shinu





0
Julian
Top achievements
Rank 1
answered on 06 Feb 2009, 02:26 PM
Thank you Shinu I will take a look at the article.
Tags
Grid
Asked by
Julian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Julian
Top achievements
Rank 1
Share this question
or