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

Formatting Excel cells in export?

4 Answers 243 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 18 Oct 2008, 10:04 AM
Hi,

I am going a bit crazy trying to accomplish the following formatting for Excel exports:

1. set row (or cell) height
2. set column width
3. set row (or cell) backcolor and forecolor
4. If using ExcelML, removing the dropdowns from the header row.
5. If using ExcelFormat-html, setting font size (and color).

It seems like there should be a way to do this.  I have tried:
1. Using ExcelML format and setting styles in the ExcelML style events - I can get the backcolor/forecolor changed, but not width or height.
2. Using ExcelFormat=html and trying to set the attributes in the radgrid columns as well as in the ExcelExportCellFormattingEvent.

If I'm missing something or if there is a guide to formatting, please let me know!

I am running into similar problems with PDF export as well.  In fact, I can't seem to get any kind of color styling in PDF.

Thanks much,
Michael

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 20 Oct 2008, 03:24 PM
Hi Michael,

You can accomplish the desired functionality very easily by adding ExcelML attributes to the created objects. I have attached a simple implementation of the requested behavior. For more information on ExcelML legal elements and attributes please refer to this msdn article here.
I hope this information helps.

All the best,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
bradley baker
Top achievements
Rank 1
answered on 23 Oct 2009, 08:46 PM
How would I do this in VB?  Im trying to set the column widthand its not working.  It wont build.  Prperty access must assign to the property or use its value and Identifer expected are the two errors I get.

Imports System  
Imports System.Collections.Generic  
Imports System.Configuration  
Imports System.Data  
Imports System.Data.Common  
Imports System.Data.SqlClient  
Imports System.Web.UI  
Imports Telerik.Web.UI  
Imports Telerik.Web.UI.GridExcelBuilder  
 
    Protected Sub SalesEXPGrid_ExcelMLExportRowCreated(ByVal source As ObjectByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs)  
        For Each col As ColumnElement In SalesEXPGrid.MasterTableView.Columns  
            col.Attributes["ss:Width"] = "200" 
        Next 
    End Sub 
0
Mark Galbreath
Top achievements
Rank 2
answered on 20 Nov 2009, 02:58 PM
Why are we using technology 8+ years old?  Isn't it about time you guys implemented Open XML (Office 2007) exports?
0
Rosen
Telerik team
answered on 25 Nov 2009, 11:29 AM
Hello Mark,

Thank you for your suggestion. I have forward it to our development department for future consideration.

Kind regards,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Rosen
Telerik team
bradley baker
Top achievements
Rank 1
Mark Galbreath
Top achievements
Rank 2
Share this question
or