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

[Solved] How to set width on exporting to PDF

3 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jols
Top achievements
Rank 2
Jols asked on 19 May 2009, 11:09 AM
hello to all
              good day ! i have an exporting here on my page, and my first  question is how am i going to set the width of the column to make fit on the PDF during exporting.. is there a way to set the page setup programmatically? and my second question is on CSV exporting how am i going to hide the clientselectcolumn(mycheckbox on the page) during exporting to CSV..

sample codes is higly appreciated

thanks to all

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 19 May 2009, 01:01 PM
Hello Jols,

Straight to your questions:

1) How to fit all columns in PDF file:
Export To PDF to fit a page

2) Hide a column of your choice when exporting to CSV:
protected void Button1_Click(object sender, EventArgs e) 
    RadGrid1.MasterTableView.GetColumn("mySelectColumn").Visible = false
    RadGrid1.MasterTableView.ExportToCSV(); 

Kind 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
Jols
Top achievements
Rank 2
answered on 20 May 2009, 04:26 AM
thanks a lot its work, another question how am i going to format this one 1/4 in excel and CSV during exporting i only see a number formating here but i dont say for fraction format..please help

thanks
0
Princy
Top achievements
Rank 2
answered on 20 May 2009, 06:00 AM
Hello Jols,

You can format fraction values for a column while exporting by adding a style attribute named mso-number-format as shown below:
c#:
  bool _exporting; 
   protected void Button1_Click(object sender, EventArgs e) 
    { 
        _exporting = true
        RadGrid1.ExportSettings.ExportOnlyData = true
        RadGrid1.ExportSettings.IgnorePaging = true
        RadGrid1.MasterTableView.ExportToExcel(); 
    } 
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (_exporting && e.Item is GridDataItem) 
        { 
            ((GridDataItem)e.Item)["ColumnUniqueName"].Style["mso-number-format"] = @"\#\ ???\/???"
        } 
    } 
 
Thanks
Princy.
Tags
Grid
Asked by
Jols
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Jols
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or