ExportSettings API

17 posts, 0 answers
  1. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 12 Nov 2009 Link to this post

    Is there a way to control the formatting style of the manufactured spreadsheet?  How about getting rid of the empty row between the header row and first data row?

    tia,
    Mark
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Nov 2009 Link to this post

    Hello Mark,

    Have you enabled filtering in your grid? If so, probably that should be the reason for an empty row between the header row and the first data row and inorder to hide that while exporting you can try setting the AllowFiltering property of the grid to false on exporting:
    c#:
    protected void Button1_Click(object sender, EventArgs e) 
        {        
            RadGrid1.ExportSettings.ExportOnlyData = true;        
            RadGrid1.ExportSettings.IgnorePaging = true
            RadGrid1.MasterTableView.AllowFilteringByColumn = false;        
            RadGrid1.ExportSettings.OpenInNewWindow = true ;         
            RadGrid1.MasterTableView.ExportToExcel(); 
        } 

    Hope this helps..
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 13 Nov 2009 Link to this post

    Yes, Princy, I did set the filtering and once I set it for excelML, the empty row disappeared.  However, what I need is a way to format various numbers as they are being exported so that they show up in Excel as non-decimal currency, for example.  I can to that in my own code using Open XML, but it's a PITA and would be nice if RadGrid would do it for me.

    Mark
  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 18 Nov 2009 Link to this post

    Hello Mark,

    Try the following approach:
    protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
    {
        e.Row.Cells.GetCellByName("myColumnName").StyleValue = "myStyle";
    }
    protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
    {
        StyleElement myStyle = new StyleElement("myStyle");
        myStyle.NumberFormat.Attributes["ss:Format"] = "$ #";
        e.Styles.Add(myStyle);
    }

    I hope this helps.

    Kind regards,
    Daniel
    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.
  6. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 19 Nov 2009 Link to this post

    Woah!  Where did Telerik.Web.UI.GridExcelBuilder come from???  I have never seen this in any documentation; is there any documentation?

    Thanks a lot, Daniel!  This promises to help on static (predefined) queries.  I have also written a simple database query wizard that dumps the result into a RadGrid, and am wondering if there is a way to tag fields based on content for formatting for dynamic queries?  I am just beginning to think about this....
  7. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 19 Nov 2009 Link to this post

    Hello Mark,

    At this point ExcelML format is not fully documented but I confirm we are working on it. I suppose it will be uploaded with the next release of RadControls for ASP.NET AJAX - Q3 2009 SP1. The expected release date is around the midst of December.

    As to the tagging related question - could you please post a more detailed explanation so I could provide straight to the point answer?

    Best regards,
    Daniel
    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.
  8. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 19 Nov 2009 Link to this post

    Hey Daniel,

    Thanks for the prompt reply.  Without the documentation, I can't figure out how to integrate the 2 methods you posted above.  How and where are they called?  What is passed to them?

    EXPORT ISSUE: The RadGrids I have created all summer and fall have all been structurally defined in the markup and databound in the code-behind; all have exported to Excel (1997-2003 version, at least) readily.  Now, however, I have defined a structureless RadGrid in the markup and dynamically databind it in the code-behind based on ad hoc queries built by users in the markup.  Users build a query on the aspx page and submit.  My code-behind fills the RadGrid with the dataset resulting from executing the user query.  Everything is find - the RadGrid displays the results either paged or unpaged.

    The issue is, user queries can return thousands of large records and this necessitates the use of paging.  However, ExportToExcel() is only exporting the page that is displayed, even though the IgnorePaging attribute in the ExportSettings is True.  Also, exporting in ExcelML throws a NullPointerException (or whatever it's called in .NET), though this also works for my static RadGrids.

    Is this a bug?

    I cannot return a RadGrid with 15,000 records to a web page; paging has to be enabled.
  9. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 20 Nov 2009 Link to this post

    I've spent the better part of the morning reading every thread in a search on "Export Settings" and I find a single reference made by a user replying to a Telerik tech that there are different event handlers for exporting in HTML and exporting in ExcelML.  Why isn't something as fundamental as this stated somewhere by Telerik?  If you guys would spend 25% of the time on documentation as you do answering questions in these fora and in the blog, you wouldn't have to be answering all these questions because we could figure the answers out for ourselves.

    Poor documentation == job security?
  10. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 20 Nov 2009 Link to this post

    Hello Mark,

    Onto your questions:

    Thanks for the prompt reply.  Without the documentation, I can't figure out how to integrate the 2 methods you posted above.  How and where are they called?  What is passed to them?

    ExcelMLExportRowCreated event is similar to RadGrid's ItemCreated event but it is ExcelML-specific. For example you can use it to access/modify the structure of the exported file (add remove rows/cells, etc), assign styles/values to cells and so on.
    ExcelMLExportStylesCreated is exposed to allow you to define your own styles to customize the appearance of the exported file (borders, background/foreground colors, fonts, alignment and so on)
    As I stated before we temporary removed a part of the documentation as it needed a major rework.

    However, ExportToExcel() is only exporting the page that is displayed, even though the IgnorePaging attribute in the ExportSettings is True.

    This is not expected under normal circumstances. If you submit a runnable demo (attached to a support ticket) I will be able to debug it locally and find where the problem comes from.

    Also, exporting in ExcelML throws a NullPointerException (or whatever it's called in .NET), though this also works for my static RadGrids.

    I noticed that you found the answer in another forum thread. Let me know if the problem still exists.

    I've spent the better part of the morning reading every thread in a search on "Export Settings" and I find a single reference made by a user replying to a Telerik tech that there are different event handlers for exporting in HTML and exporting in ExcelML.  Why isn't something as fundamental as this stated somewhere by Telerik?  If you guys would spend 25% of the time on documentation as you do answering questions in these fora and in the blog, you wouldn't have to be answering all these questions because we could figure the answers out for ourselves.
    As I mentioned several times before, we had such documentation but we decided to rework it from scratch. The updated version will be available in the midst of December together with the next release of RadControls for ASP.NET AJAX. Excuse us for the inconvenience.

    Poor documentation == job security?
    I don't really understand the pun here :-)  I already answered your criticism about the documentation. Our documentation team is currently working on much better and complete description about the supported formats.

    Regards,
    Daniel
    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.
  11. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 20 Nov 2009 Link to this post

    As too often happens, Daniel, the humor is lost in the translation.

    Thanks for the comprehensive response.  I have opened a support ticket #260437 regarding this issue and submitted anecdotal descriptions as well as a zip file of my source code.  And I continue to get Null Reference Exceptions when trying to use ExcelML.

    Regards,
    Mark
  12. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 25 Nov 2009 Link to this post

    Hello Mark,

    For the convenience of the future readers of this thread, I posted a short quote from my answer below:
    RadGrid's ExcelML data engine tries to fetch the data directly from your datasource, but it fails since you use simple data binding - this means that no data will be available after the postback caused by your button. To sidestep this situation, you should use the NeedDataSource event.

    Best regards,
    Daniel
    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.
  13. david
    david avatar
    6 posts
    Member since:
    Jun 2009

    Posted 11 Dec 2009 Link to this post

    I too have been very frustrated with the lack of documentation on these features ... I have waisted the better part of several days trying to figure out how to get this to work.

    I highly suggest BEFORE you advertise and release a great feature like this  that you FIRST make sure the proper and COMPLETE documentation is available. I finally just gave up using the ExcelML option ....

    PLEASE make it known when your features don't work as advertise and you don't have documentation nor support for it.

    We enjoy your product but it instances like this that makes my management wonder if we should find another provider.

  14. david
    david avatar
    6 posts
    Member since:
    Jun 2009

    Posted 11 Dec 2009 Link to this post

    SUGGESTION:   when you reply to a question and provide code please provide examples in both C# and VB ....  many of us are not bilingual and it would help to have the examples in the language we are use to  ..... thanks   .... Please pass this suggestion on to all those in Telerik who are providing answers.

    thanks

  15. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 11 Dec 2009 Link to this post

    Dear David,

    Thank you for the feedback

    I too have been very frustrated with the lack of documentation on these features ... I have waisted the better part of several days trying to figure out how to get this to work.

    Currently the only export format that isn't thoroughly documented is ExcelML. I'd like to remind you that as a customer, you may submit a support ticket - our support department will address your inquiry and will provide the information you are looking for.

    Please examine the following links:
    The old documentation (obsolete)
    The new documentation (work in progress)

    I highly suggest BEFORE you advertise and release a great feature like this  that you FIRST make sure the proper and COMPLETE documentation is available. I finally just gave up using the ExcelML option ....
    We always had the documentation in question, we just temporary removed it from the table of contents (for about 3 weeks).

    SUGGESTION:   when you reply to a question and provide code please provide examples in both C# and VB ....  many of us are not bilingual and it would help to have the examples in the language we are use to  ..... thanks   .... Please pass this suggestion on to all those in Telerik who are providing answers.
    A good part of the community (this applies to Telerik staff also) naturally writes in C# or VB. When someone needs to translate the code, he can use our online code converter
    Telerik Code Converter
    DeveloperFusion Convertor
    CarlosAg CodeTranslator

    Best regards,
    Daniel
    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.
  16. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 14 Dec 2009 Link to this post

    Cool stuff!  Thanks, Daniel!

    Mark
  17. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 20 Apr 2011 Link to this post

    Hi Daniel,

    I am using this format for date. but i want format for align="center".

    How to i get this format. please let me know,

    Thanks,
    Dhamu.
  18. Albert Shenker
    Albert Shenker avatar
    551 posts
    Member since:
    Mar 2004

    Posted 23 Aug 2011 Link to this post

    Dim centerStyle As New Telerik.Web.UI.GridExcelBuilder.StyleElement("CenterStyle"
    centerStyle .AlignmentElement.HorizontalAlignment = GridExcelBuilder.HorizontalAlignmentType.Center 

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017