RAS export to Excel - new Worksheet by group

Hi,
I have a report sales by salesperson ( group by salesperson) . New page after each salesperson.
Printing is fine, however now I have the request when exporting to Excel to make each salesperson its own worksheet in the excel workbook.
Is this possible using RAS to for Excel export ?
Thanks
Oskar

Adam, Ludek,
thanks.
At least I now know what I cannot do ...
Then probably the only way is to write the stuff into one worksheet - to file - and then either modify the file or use office interop
Thanks
Oskar

Similar Messages

  • Matrix exporting to excel with empty columns, with page break option of "Between each instance of a group" selected.

    I am working with Report Builder 3.0 I am using a matrix to produce grouped data on separate worksheets in excel.
    The select is:
    SELECT ID, Measurement, Value, [Date] FROM Measurements_Report. (please ignore the underscores they are just for formatting) 
    The contents of the Measurements_Report table:
    ID__Measurement__Value__[Date]
    1___Hot_________33_____10/1/2014
    2___Hot_________44_____10/2/2014
    3___Cold_________55_____10/2/2014
    The matrix contains a single row group based on the field "measurement". The Measurement group has the page break option of "Between each instance of a group" selected. 
    There is a column group based on the field "Date". 
    When this is matrix is exported to excel on the first worksheet (Hot) there are three columns as shown below:
    ID__10/1/2014____10/2/2014___10/2/1014
    1___33
    2_______________44
    Notice the last column doesn't have a value.
    On the second worksheet (Cold) there are also three columns as shown below:
    ID__10/1/2014___10/2/2014___10/2/1014
    3__________________________55
    This time notice there is only one row and only a value in the last column.
    I only want the columns with data for that worksheet to show up. How can I remove these empty/duplicate columns? Hopefully there is a simple fix. Thanks ahead of time.

    With the following contents of the Measurements_Report table:
    ID__Measurement__Value__[Date]
    1___Hot_________33______10/1/2014
    2___Hot_________43______10/1/2014
    2___Hot_________44______10/2/2014
    3___Cold________55______10/2/2014
    Returns on the first tab (Hot):
    ID__10/1/2014____10/1/2014____10/2/2014
    1___33
    2_________________43
    2______________________________44
    In the excel worksheet it contains a separate column for each date with a value. Thanks again!
    Why is the same date repeating on multiple columns? Do you've the time part also returned from database?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Applescript - coping columns in a new worksheet in Excel 2004

    Dear all,
    I’m new to Applescript and would appreciate a help on the following:
    I'm trying to copy in different worksheets of a new Excel 2004 workbook(New _WB.xls) different columns (blocs of text + data) in the same worksheet (lest’s call it file1 of a workbook named Old_WB.xls). The columns are separated by 2 empty rows.
    I've searched solutions online with no luck.  Can anyone show me how to code the solution of this problem in Applescript?
    Thanks in advance.
    Ghan

    well, then you want something like so:
    tell application "Microsoft Excel"
              open alias "path:to:workbook"
              set x to value of used range of worksheet 1 of workbook 1
    end tell
    set block to {}
    set idx to 1
    repeat with thisLine in x
              if thisLine as list = {"*", "", ""} or thisLine as list = {"", "", ""} then
      -- empty line means end of block; make sure some block has been collected then process
                        if block is not {} then
                                  set rowCount to count of block
                                  tell application "Microsoft Excel"
                                            tell workbook 1
                                                      set nws to make new worksheet at end
                                                      tell nws
                                                                set name to "file" & idx
                                                                set value of range ("A1:C" & rowCount) to block
                                                      end tell
                                            end tell
                                  end tell
                                  set idx to idx + 1
                                  set block to {}
                        end if
                        if thisLine as list = {"*", "", ""} then
      --all done
                                  exit repeat
                        end if
              else
                        copy thisLine to end of block
              end if
    end repeat
    I've used a "*" character o signify the end of data - you'll need to change that to what you use in lines 9 and 25. Be careful that there's nothing else written outside of the data range because the used range command will pick up on it and goof things up.

  • Formatting of Excel worksheet While using Export to Excel

    Hello Experts,
    I have a requirement to format the workbook according to the user needs while the user clicks "Export to Excel" in the webpage of Web template.
    The major problem is with the hierarchy.. when exporting, the hierarchy nodes have triangular symbols.. is there any way to remove them??
    What can i do, so that i can make changes to the default export format of the workbook, while exporting it??
    Any helpful suggession will be appreciated and rewarded.
    Thanks and Best Regards,
    Vikas Bittera.

    Hi Mark,
    Thank you very much for the response.. however this is not the full solution of my problem..
    Now, if i execute the same query in the BEx explorer analyzzer, then even this setting does not work... it shows traingles.. wht oue intention is to use Excel grouping function, so that the user will have better navigation in hierarchy..
    so is there any way to do this? we need to other formatting of the output.. is it possible that we can change the standard query ouput in excel??
    Looking ahead for your response..
    Thanks and Best Regards,
    Vikas Bittera.

  • How do I add a new worksheet to an excell file utilizing a template with the report generation toolkit?

    Hello,
    My vi is gathering data from a piece of machinery. At varrious points durring the process, my vi must create printable reports. I am using the report generation tool kit to do this. What I want to do is for every report generated durring the run, add it as a new worksheet in an Excell workbook. My excell template works fine for the initial master report and I can add new data to new worksheets. What I am having a problem figuring out is how do I add the new data to a new worksheet using an excel template? I have 5 different reports that need to be generated at different times with some more often than others. I would like all these reports to be in the
    same master excel file. Thanks in advance
    -Greg
    Gregory Osenbach, CLA
    Fluke

    Hi Greg,
    There is no built-in support in LabVIEW to add a new worksheet to an existing Excel report simply because this functionality does not exist in the Excel application itself.
    My suggestion would be to open up the template you wish to use for the new worksheet. Copy the cells from the template and paste them into your new worksheet that you've created. Then close the original template and you have another copy of the template in which you can populate with data values.
    I have attached an example program of how to Copy and Paste a Cell in Microsoft 97 Using ActiveX in LabVIEW to this post. Hope this helps!
    Kileen C.
    Applications Engineer
    National Instruments
    Attachments:
    XL_cell_copy_and_paste.llb ‏76 KB

  • How  to add a new option for group by in a excel report

    Hi,
    there is a enhancement in a excel report
    I need to add a new option for group by
    help me
    Regards,
    Raghu

    k

  • SSRS 2012 - Groups in Report Manager aren't present when exported to Excel

    Hi all, hope somebody can help with this issue, as I cant seem to find any other posts about it
    I have a report in SSRS2012. It was copied from SSRS2005 quite recently, as we have upgraded. The SQL developer said that it didn't need any code changes, as he had some kind of tool to test code problems between the two versions.
    The report has a table, with 5 row groups, and one detail row. The table is setup as follows:
    Name                                         Sales         
    Costs       Profit
    Group1                                     
       Group2
          Group3
             Group4
                Group5
                   DetailsRow
    When I run this report using the Report Manager website from SSRS2005, and then export to Excel 2013, I get the 6 row groups in Excel, no problem whatsoever. I can drill into each group in Excel, using the group drilldown column on the left hand side. This
    works the same as the Report Manager website.
    If I run the exact same report from the Report Manager website in SSRS2012, the Report Manager result is the same as SSRS2005 - all the row groups are present, and the drilldown works fine. However, the export to Excel has issues with the groups. There are
    only 3 row groups showing in Excel, along with a column group added for no apparent reason. Drilling into each group shows inconsistent details, and there is no apparent logic as to what is shown within each group.
    Hopefully, someone has seen this issue before, and can help, because I have no idea what to do, having spent a couple of days trying to figure it out. I should also mention, that this issue with groups is seen on all my reports which have groups, not just
    this report
    Thanks for any and all help
    Naz

    Hi Naz,
    According to your description, the report works correctly in SSRS 2005 while the same report doesn’t work in SSRS 2012 when exporting to a Excel file.
    In your scenario, please make sure you are migrating the report from SSRS 2005 to SSRS 2012 instead of copying the .rdl directly. Generally, we are using Reporting Services Migration Tool to migrate reports between report server. Please refer to this article:
    SQL Server Reporting Services: Migrating SSRS reports, data sources and subscriptions from one server to another.
    After migrating the report successfully, you should upgrade the report definition in SQL Server Data Tools to upgrade the .rdl file. Please refer to this article:
    Upgrade Reports.
    If you have upgraded the report but the issue still persists, please provide report design for our analysis. If possible, please provide some screenshots about the preview result and Excel render result.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Export to Excel suppress Group information

    Is there a way to suppress group information only when exporting to Excel?  When viewing or printing the report I want to see the group information but when exporting to Excel I do not want to see group information.
    Is there any way to pick up when the report is being exported in the suppress formula?
    Thanks for any help.

    fhs,
    I ran into this a few months ago and solved it by simply creating a parameter called Output to Excel. I then suppress any sections if that parameter is true.
    So, in theory, you could run the report once viewing the group info, and then run it again, suppressing the group info so u can export to excel.
    If there's a better way, I'd be interested in learning about it as well.
    John

  • Viewer Crosstab Excel Export - Limit to Static Worksheet

    I'd like to know if it's possible to limit the export of a crosstab worksheet to excel to just a static worksheet (eg. Crosstab_Static excel worksheet ). In advance, thanks for your assistance.

    Hi Alvaro
    Not sure of your question and what exactly you mean by a static worksheet. If you want to export static data why not use the command line interface? This way you can define how the worksheet looks and then call it to produce the output without any intervention from any users who might go and change the format.
    Does this help?
    Regards
    Michael

  • HOW CAN I ADD NEW WORKSHEET(TAB) TO EXCEL USING ABAP pROGRAM?

    i want to add new tabs to my excel file using abap.... can someone help me on this?

    hi,
    PERFORM add_worksheet USING 'Test 1'.
    *& Form ADD_WORKSHEET
    FORM add_worksheet USING i_name.
    Add new worksheet
      IF g_first_ws <> 'N'.
        g_first_ws = 'N'.
        GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
      ELSE.
        CALL METHOD OF g_worksheets 'Add' = g_worksheet.
      ENDIF.
      SET PROPERTY OF g_worksheet 'NAME' = i_name.
      g_row = 1.
      g_col = 1.
    ENDFORM. " ADD_WORKSHEET

  • SSIS 2008 R2 Excel Destination Error, "An OLE DB error has occurred. Error code: 0x80040E21.", cannot export to the new Excel (.xlsx) format

    Hello.
    I've been attempting to do a very simple task that just isn't working.  For a Data Flow Task action in SSIS, I am trying to export data from a single SQL Server (2008 R2) database table to an Excel spreadsheet (.xlsx).  No matter what I do, it
    just keeps failing.  The columns in the table match the column header names (in the first row) in the tab I select.  Here is the output I get.
    SSIS package "Package.dtsx" starting.
    Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
    Warning: 0x80049304 at Data Flow Task, SSIS.Pipeline: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available.  To resolve, run this package as an administrator, or on the system's
    console.
    Information: 0x40043006 at Data Flow Task, SSIS.Pipeline: Prepare for Execute phase is beginning.
    Information: 0x40043007 at Data Flow Task, SSIS.Pipeline: Pre-Execute phase is beginning.
    Error: 0xC0202009 at Data Flow Task, Excel Destination [52]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.
    Error: 0xC0202025 at Data Flow Task, Excel Destination [52]: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
    Error: 0xC004701A at Data Flow Task, SSIS.Pipeline: component "Excel Destination" (52) failed the pre-execute phase and returned error code 0xC0202025.
    Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning.
    Information: 0x4004300B at Data Flow Task, SSIS.Pipeline: "component "Excel Destination" (52)" wrote 0 rows.
    Information: 0x40043009 at Data Flow Task, SSIS.Pipeline: Cleanup phase is beginning.
    Task failed: Data Flow Task
    SSIS package "Package.dtsx" finished: Success.
    I kick-off the action and sometimes is hangs for a few seconds (20+ seconds) and sometimes it doesn't, but either way it fails.  I tried this on a 32-bit machine, 64-bit machine, and still it fails.  I tried an OLE DB connection to Excel and
    that doesn't work either.  I made sure that the connection string for the Excel spreadsheet is Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[filepath\excelfile].xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES"; and still it doesn't work.  
    Now, when I switch it over to export to an Excel 2003 spreadsheet (.xls) it works!  But I don't want it to go to the old Excel spreadsheet format, my requirement is to export the data to the new format.  Is there a bug in the Access 2010 Database
    Engine that won't allow me to export to the new Excel format?  Otherwise, what can I be doing wrong?  I set the Run64BitRuntime property to False and it still doesn't work.  
    My solution (so far) is to export it to Excel 2003 and then via the Script Task action use the Excel COM API (Microsoft.Office.Interop.Excel.dll) for 2010, open the file and save it in the new format (.xlsx) and that works great!  However, the client
    doesn't want to install Excel on the database server!  So what can I do when the Excel Destination or OLE DB Destination (to connect to Excel) actions don't work!?  Please help!!!
    Like I mentioned, if this is a bug, that would be great to know so I can stop wasting my time.  Thanks again.

    Alright, so you mean to say is that the driver is not installed.  Isn't version 12 the 2010 Access Database Engine Driver?  I did install that, and I also tried the 2007 Access DB Engine driver, and both don't work.  What driver am I missing? 
    The connection string is correctly formatted, yes?
    Also, when setting up the OLE DB Destination action and I have it point to the Excel spreadsheet, and I specify as the provider "Microsoft Office 12.0 Access Database Engine OLE DB Provider" and click on Test Connection, the connection is
    successful.  Wouldn't that mean the 12.0 version driver is installed?
    Thanks in advance.

  • Create and name new worksheets in existing excel spreadsheet

    Hello-
    I am running LabVIEW 6i and excel2000. I need to write data acquired in LabVIEW to new worksheets of an already existing excel spreadsheet, and also name these new worksheets. I have been able to create the new worksheets but haven't yet figured out how to name them. I'm new to activeX and any help would be greatly appreciated.
    Thank you

    Hi Paul,
    Programming using ActiveX can be tricky, especially knowing just what kind of datatypes the different methods and properties are expecting. There are 2 ways I would recommend for users to find out about ActiveX parameters:
    1. Right-click and choose Help for the specific property/method.
    When you have a method or property selected on the Property or Invoke Node, you can right-click and there will be 2 help options--one for the generic Property Node or Invoke Node, the other for the specific method or property that is selected in the node itself. If you select the help for the specific property/method, a Microsoft Visual Basic Reference Help should appear that will provide you with explanations and examples of the datatypes that method/property is expecting given the object that is in use.
    2. Go to the MSDN Library >> Excel Object Model
    This has an overview of Microsoft's Excel Object Model and will also show you how to use Microsoft's Excel Object Model.
    Keep in mind that because ActiveX can be tricky, NI also offers the Report Generation Toolkit to make programming to Word and Excel much easier! Nice tutorials and examples are provided too.

  • Hyper Link Exported to Excel - Unable to open in New window

    Hello Every1,
    My Greetings for the day!!!
    I have created a SSRS Report in SQL Server 2012.
    There are many columns in the report. But the last column is a hyperlink.
    I have applied the following in code in Action properties -
    ="javascript:void(window.open('" & Fields!DataURL.Value & "','_blank'))"
    The above code is working fine, when I deploy the report in Sharepoint and click on the link. The link gets open in new window.
    However, When I export the same report to EXCEL and then click the link. It is not getting redirected.
    Please provide some solution.
    Regards,
    Hiren Parikh
    Hiren Parikh

    Hi,
    I have got the solution.
    Please see the below code :-
    =IIf(Globals!RenderFormat.IsInteractive,"javascript:void(window.open('" & Fields!URL.Value & "','_blank'))",Fields!URL.Value)
    It really worked. Now, When I export to excel and click on the link. It opens in a new window.
    Regards,
    Hiren
    Hiren Parikh

  • Export to Excel Question

    Forms [32 Bit] Version 10.1.2.3.0 (Production)
    How can I get the field names as column headings on export excel for the first row using my cursor below?
    PROCEDURE generate_summary IS
    l_filename varchar2(200);
    FLAG BOOLEAN;
    directory_name varchar2(200);
    application Client_OLE2.Obj_Type;
    workbooks Client_OLE2.Obj_Type;
    workbook Client_OLE2.Obj_Type;
    worksheets Client_OLE2.Obj_Type;
    worksheet Client_OLE2.Obj_Type;
    args Client_OLE2.List_Type;
    cell ole2.Obj_Type;
    k INTEGER;
    j integer;
         CURSOR x_cur IS
              SELECT emp_id,
                           name,
                           dept
              FROM   emp;
    begin
    l_filename := webutil_file.file_save_dialog
    (directory_name => '<dir>:\'
    ,file_name => 'summary'||sysdate||'.xls'
    ,file_filter => null
    ,title => 'Select client side filename where App Server file will be saved');
    /* Calling Excel and adding a new worksheet to a blank workbook */
    application := Client_OLE2.create_obj('Excel.Application');
    CLIENT_OLE2.SET_PROPERTY(APPLICATION, 'VISIBLE', false);
    workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
    workbook := Client_OLE2.Invoke_Obj(workbooks, 'Add');
    worksheets := Client_OLE2.Get_Obj_Property(workbook, 'Worksheets');
    worksheet := Client_OLE2.Invoke_Obj(worksheets, 'Add');
    j:=1;
    for x_rec in x_cur loop
      args:=Client_OLE2.create_arglist;
      Client_OLE2.add_arg(args, j);
      Client_OLE2.add_arg(args, 1);
      cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
      Client_OLE2.destroy_arglist(args);
      Client_OLE2.set_property(cell, 'Value', name_in(x_rec.emp_id));
      Client_OLE2.release_obj(cell);
      args:=Client_OLE2.create_arglist;
      Client_OLE2.add_arg(args, j);
      Client_OLE2.add_arg(args, 2);
      cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
      Client_OLE2.destroy_arglist(args);
      Client_OLE2.set_property(cell, 'Value', name_in(x_rec.name));
      Client_OLE2.release_obj(cell);
      args:=Client_OLE2.create_arglist;
      Client_OLE2.add_arg(args, j);
      Client_OLE2.add_arg(args, 3);
      cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
      Client_OLE2.destroy_arglist(args);
      Client_OLE2.set_property(cell, 'Value', name_in(x_rec.dept));
      Client_OLE2.release_obj(cell);
      j:=j+1;
    end loop;
    Client_OLE2.Release_Obj(worksheet);
    Client_OLE2.Release_Obj(worksheets);
    /* Save the Excel file created */
    args := Client_OLE2.Create_Arglist;
    Client_OLE2.Add_Arg(args,l_filename);
    Client_OLE2.Invoke(workbook, 'SaveAs', args);
    Client_OLE2.Destroy_Arglist(args);
    /* release workbook */
    Client_OLE2.Release_Obj(workbook);
    Client_OLE2.Release_Obj(workbooks);
    /* Release application */
    Client_OLE2.Invoke(application, 'Quit');
    Client_OLE2.Release_Obj(application);
    /* Display successfull message */
    message('File successfully saved as ' || l_filename);
    END;The output generated only contains the data, no column headings.
    Thanks!

    This is a piece of my total procedure. If row = 2, it means that you are getting the first row of data. In that case, write row 1 (the header row) first.
       -- Get the data
       first_record;
       -- Data starts at row 2. Row 1 is for the header.
       v_row  := 2;
       <<record_loop>>
       loop
          v_item := v_first_item;
          v_col  := 1;
          <<item_loop>>
          loop
             exit when v_item =i_block||'.'||null;  -- no more items in the block
             if not id_null(find_item(v_item))
             then
                if get_item_property(v_item,item_type) in ('TEXT ITEM','DISPLAY ITEM','CHECKBOX','RADIO GROUP','LIST')
                and get_item_property(v_item,visible) = 'TRUE'
                then
                   if v_row = 2
                   then
                      -- v_row=2: 1st data row, so put the column headers in row 1
                      -- Column header is: 1)item prompt 2)database column name
                      v_header := get_item_property(v_item,prompt_text);
                      if v_header is null
                      then
                         v_header := get_item_property(v_item,column_name);
                         if v_header is null
                         then
                            v_header := '?';
                         end if;
                      end if;
                      -- Put the column header in row 1
                      put_cell(1,v_col,v_header);
                   end if;

  • After Export to Excel File error while opening using xmlwriter in silverlight

    Can one help me in fixing following issue after to export to excel had done iam getting following error message 
    "The file you are trying to open, 'test.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do uou want to open the file now ?"
    If i click Yes file opens correctly but it shows above message . Can any one suggest me how to avoid this programatically with the following code.
    I tried by changing the file saving as  .xls to .xlsx  but it doesnt works.
    Public Sub Export()
    Dim ss As String = "urn:schemas-microsoft-com:office:spreadsheet"
    Dim DataType As String
    Dim DataValue As Object
    'Dim DataView As C1.Silverlight.Data.DataView = m_DataGrid.ItemsSource
    'Dim ItemsSource As C1.Silverlight.Data.DataTable = DataView.Table
    Dim XmlSettings As XmlWriterSettings
    Dim ColumnBinding As Binding
    Dim FieldName As String
    Dim DataGridColumn As C1.Silverlight.DataGrid.DataGridColumn
    Dim ColumnIndex As Integer
    Dim J As Integer
    Dim DataGridRow As C1.Silverlight.DataGrid.DataGridRow
    Dim CommonUtil As New GoldCRM.Core.Common.Util
    Dim PropertyInfo As System.Reflection.PropertyInfo
    Dim CellFormat As String
    Try
    If m_DataGrid.Rows.Count = 0 Then Exit Try
    XmlSettings = New XmlWriterSettings
    XmlSettings.Indent = True
    XmlSettings.NewLineOnAttributes = False
    Using myXML As XmlWriter = XmlWriter.Create(m_Stream, XmlSettings)
    With myXML
    .WriteStartDocument()
    .WriteProcessingInstruction("mso-application", "progid=" & ControlChars.Quote & "Excel.Sheet" & ControlChars.Quote)
    .WriteStartElement("Workbook", ss)
    .WriteStartElement("DocumentProperties", "urn:schemas-microsoft-com:office:office")
    .WriteElementString("Author", m_DocumentProperties.Author)
    .WriteElementString("LastAuthor", String.Format("{0} {1}", Application.Current.Resources("EmpFirstName"), Application.Current.Resources("EmpLastName")))
    .WriteElementString("Created", m_DocumentProperties.Created)
    .WriteElementString("LastSaved", m_DocumentProperties.LastSaved)
    .WriteElementString("Company", Application.Current.Resources("REPORTINGSITENAME"))
    .WriteElementString("Version", m_DocumentProperties.Version)
    .WriteEndElement() 'Document Properties
    .WriteStartElement("ExcelWorkbook", "urn:schemas-microsoft-com:office:excel")
    .WriteElementString("WindowHeight", m_WorkbookProperties.WindowHeight)
    .WriteElementString("WindowWidth", m_WorkbookProperties.WindowWidth)
    .WriteElementString("WindowTopX", m_WorkbookProperties.WindowTopX)
    .WriteElementString("WindowTopY", m_WorkbookProperties.WindowTopY)
    .WriteElementString("ProtectStructure", m_WorkbookProperties.ProtectStructure)
    .WriteElementString("ProtectWindows", m_WorkbookProperties.ProtectWindows)
    .WriteEndElement() 'Excel Workbook
    .WriteStartElement("Styles")
    For I As Integer = 0 To m_Styles.Count - 1
    .WriteStartElement("Style")
    .WriteAttributeString("ss", "ID", ss, m_Styles(I).ID)
    If m_Styles(I).Name <> "" Then
    .WriteAttributeString("ss", "Name", ss, m_Styles(I).Name)
    End If
    'ALIGNMENT LOGIC:
    .WriteStartElement("Alignment")
    If Not m_Styles(I).Alignment Is Nothing Then
    If m_Styles(I).Alignment.Horizontal <> 0 Then
    .WriteAttributeString("ss", "Horizontal", ss, m_Styles(I).Alignment.Horizontal.ToString)
    End If
    If m_Styles(I).Alignment.Vertical <> 0 Then
    .WriteAttributeString("ss", "Vertical", ss, m_Styles(I).Alignment.Vertical.ToString)
    End If
    If m_Styles(I).Alignment.WrapText = True Then
    .WriteAttributeString("ss", "WrapText", ss, "1")
    End If
    End If
    .WriteEndElement()
    'BORDER LOGIC:
    .WriteStartElement("Borders")
    .WriteStartElement("Border")
    .WriteAttributeString("ss", "Position", ss, "Bottom")
    .WriteAttributeString("ss", "LineStyle", ss, "Continuous")
    .WriteAttributeString("ss", "Weight", ss, "1")
    .WriteEndElement() 'Border
    .WriteStartElement("Border")
    .WriteAttributeString("ss", "Position", ss, "Left")
    .WriteAttributeString("ss", "LineStyle", ss, "Continuous")
    .WriteAttributeString("ss", "Weight", ss, "1")
    .WriteEndElement() 'Border
    .WriteStartElement("Border")
    .WriteAttributeString("ss", "Position", ss, "Right")
    .WriteAttributeString("ss", "LineStyle", ss, "Continuous")
    .WriteAttributeString("ss", "Weight", ss, "1")
    .WriteEndElement() 'Border
    .WriteStartElement("Border")
    .WriteAttributeString("ss", "Position", ss, "Top")
    .WriteAttributeString("ss", "LineStyle", ss, "Continuous")
    .WriteAttributeString("ss", "Weight", ss, "1")
    .WriteEndElement() 'Border
    .WriteEndElement() 'Borders
    'FONT LOGIC:
    .WriteStartElement("Font")
    Dim myFont As Excel.Styles.Font = m_Styles(I).Font
    .WriteAttributeString("ss", "FontName", ss, myFont.FontName.ToString)
    .WriteAttributeString("ss", "Size", ss, myFont.Size)
    .WriteAttributeString("ss", "Color", ss, myFont.Color.ToString.Remove(1, 2))
    If myFont.Bold = True Then .WriteAttributeString("ss", "Bold", ss, "1")
    If myFont.Italic = True Then .WriteAttributeString("ss", "Italic", ss, "1")
    If myFont.Underline <> 0 Then .WriteAttributeString("ss", "Underline", ss, myFont.Underline.ToString)
    .WriteEndElement()
    Dim myInterior As Excel.Styles.Interior = m_Styles(I).Interior
    .WriteStartElement("Interior")
    .WriteAttributeString("ss", "Color", ss, myInterior.Color.ToString.Remove(1, 2))
    .WriteAttributeString("ss", "Pattern", ss, "Solid")
    .WriteEndElement()
    .WriteStartElement("NumberFormat")
    .WriteEndElement()
    .WriteStartElement("Protection")
    .WriteEndElement()
    .WriteEndElement() 'Style
    Next I
    .WriteStartElement("Style")
    .WriteAttributeString("ss", "ID", ss, "DateStyle")
    .WriteStartElement("NumberFormat")
    .WriteAttributeString("ss", "Format", ss, "General Date")
    .WriteEndElement() 'NumberFormat
    .WriteEndElement() 'Style
    .WriteStartElement("Style")
    .WriteAttributeString("ss", "ID", ss, "HeaderStyle")
    .WriteStartElement("Font")
    .WriteAttributeString("x", "Family", ss, "Swiss")
    .WriteAttributeString("ss", "Bold", ss, "1")
    .WriteEndElement() 'Font
    .WriteEndElement() 'Style
    .WriteEndElement() 'Styles
    'WORKSHEETS:
    .WriteStartElement("Worksheet")
    .WriteAttributeString("ss", "Name", ss, "WORKSHEET")
    .WriteStartElement("Table")
    .WriteAttributeString("ss", "ExpandedColumnCount", ss, m_DataGrid.Columns.Count)
    .WriteAttributeString("ss", "ExpandedRowCount", ss, m_DataGrid.Rows.Count + 100) 'Temporary fix: sometimes 1 row is not added.
    .WriteAttributeString("ss", "FullColumns", ss, m_DataGrid.Columns.Count)
    .WriteAttributeString("ss", "FullRows", ss, m_DataGrid.Rows.Count + 100) 'Temporary fix: sometimes 1 row is not added.
    .WriteAttributeString("ss", "DefaultRowHeight", ss, 15)
    For Each DataGridColumn In m_DataGrid.Columns
    If DataGridColumn.Visibility = Visibility.Visible Then
    .WriteStartElement("Column")
    If TypeOf DataGridColumn Is C1.Silverlight.DataGrid.DataGridNumericColumn Then
    .WriteAttributeString("ss", "AutoFitWidth", ss, 1)
    ElseIf TypeOf DataGridColumn Is C1.Silverlight.DataGrid.DataGridDateTimeColumn Then
    .WriteAttributeString("ss", "AutoFitWidth", ss, 1)
    Else
    .WriteAttributeString("ss", "AutoFitWidth", ss, 0)
    End If
    If DataGridColumn.Width.Value <= 100 Then
    .WriteAttributeString("ss", "Width", ss, 100)
    Else
    .WriteAttributeString("ss", "Width", ss, DataGridColumn.Width.Value)
    End If
    .WriteEndElement()
    End If
    Next
    J = 0
    For Each DataGridRow In m_DataGrid.Rows
    J += 1
    If TypeOf DataGridRow Is GoldCRM.Controls.Filter.clsFilterRow Then
    .WriteStartElement("Row")
    .WriteAttributeString("ss", "Index", ss, J)
    .WriteAttributeString("ss", "AutoFitHeight", ss, 0)
    .WriteAttributeString("ss", "Height", ss, 15)
    ColumnIndex = 0
    For Each DataGridColumn In m_DataGrid.Columns
    If DataGridColumn.Visibility = Visibility.Visible Then
    FieldName = String.Empty
    If TypeOf DataGridColumn Is DataGridBoundColumn Then
    ColumnBinding = TryCast(DataGridColumn, DataGridBoundColumn).Binding
    If ColumnBinding.Path IsNot Nothing Then
    FieldName = ColumnBinding.Path.Path
    End If
    ElseIf TypeOf DataGridColumn Is DataGridTemplateColumn Then
    If DataGridColumn.FilterMemberPath IsNot Nothing Then
    FieldName = DataGridColumn.FilterMemberPath.Trim
    End If
    End If
    If Not FieldName.Equals(String.Empty) Then
    ColumnIndex += 1
    .WriteStartElement("Cell")
    .WriteAttributeString("ss", "Index", ss, ColumnIndex)
    .WriteAttributeString("ss", "MergeAcross", ss, 0)
    .WriteAttributeString("ss", "StyleID", ss, "HeaderStyle")
    .WriteStartElement("Data")
    .WriteAttributeString("ss", "Type", ss, "String")
    If DataGridColumn.Header IsNot Nothing Then
    .WriteValue(DataGridColumn.Header.ToString)
    Else
    .WriteValue("")
    End If
    .WriteEndElement() 'Data
    .WriteEndElement() 'Cell
    End If
    End If
    Next
    .WriteEndElement() 'Row
    End If
    If Not (TypeOf DataGridRow Is GoldCRM.Controls.Filter.clsFilterRow) Then
    .WriteStartElement("Row")
    .WriteAttributeString("ss", "Index", ss, J + 1)
    .WriteAttributeString("ss", "AutoFitHeight", ss, 0)
    .WriteAttributeString("ss", "Height", ss, 15)
    ColumnIndex = 0
    For Each DataGridColumn In m_DataGrid.Columns
    If DataGridColumn.Visibility = Visibility.Visible Then
    FieldName = String.Empty
    If TypeOf DataGridColumn Is DataGridBoundColumn Then
    ColumnBinding = TryCast(DataGridColumn, DataGridBoundColumn).Binding
    If ColumnBinding.Path IsNot Nothing Then
    FieldName = ColumnBinding.Path.Path
    End If
    ElseIf TypeOf DataGridColumn Is DataGridTemplateColumn Then
    If DataGridColumn.FilterMemberPath IsNot Nothing Then
    FieldName = DataGridColumn.FilterMemberPath.Trim
    End If
    End If
    If Not FieldName.Equals(String.Empty) Then
    ColumnIndex += 1
    Dim DataCellValue As Object = Nothing
    If Not (TypeOf DataGridRow Is GoldCRM.Controls.Filter.clsFilterRow) Then
    PropertyInfo = CommonUtil.GetProperty(DataGridRow.DataItem, FieldName)
    If PropertyInfo IsNot Nothing Then
    DataCellValue = PropertyInfo.GetValue(DataGridRow.DataItem, Nothing)
    End If
    End If
    CellFormat = String.Empty
    If DataCellValue IsNot Nothing Then
    Select Case DataCellValue.GetType.Name.ToUpper
    Case "BitmapImage".ToUpper
    DataValue = "Image"
    DataType = "String"
    Case "Hyperlink".ToUpper
    DataType = "String"
    DataValue = "Hyperlink"
    Case "Decimal".ToUpper
    DataType = "Number"
    DataValue = DataCellValue
    Case "DateTime".ToUpper
    If CType(DataCellValue, Date).Year > 1900 Then
    DataType = "DateTime"
    DataValue = DataCellValue
    CellFormat = "DateStyle"
    Else
    DataType = "String"
    DataValue = DataCellValue
    End If
    Case Else
    DataType = "String"
    DataValue = DataCellValue
    End Select
    Else
    DataType = "String"
    DataValue = String.Empty
    End If
    .WriteStartElement("Cell")
    .WriteAttributeString("ss", "Index", ss, ColumnIndex)
    .WriteAttributeString("ss", "MergeAcross", ss, 0)
    If Not CellFormat.Equals(String.Empty) Then
    .WriteAttributeString("ss", "StyleID", ss, CellFormat)
    End If
    .WriteStartElement("Data")
    .WriteAttributeString("ss", "Type", ss, DataType)
    .WriteValue(DataValue)
    .WriteEndElement() 'Data
    .WriteEndElement() 'Cell
    End If
    End If
    Next
    .WriteEndElement() 'Row
    End If
    Next
    .WriteEndElement() 'Table
    .WriteEndElement() 'Worksheet
    .WriteEndElement() 'Workbook
    .WriteEndDocument()
    .Close()
    End With
    End Using
    Catch ex As Exception
    Throw New Exception(ex.Message, ex)
    Finally
    If m_Stream IsNot Nothing Then
    m_Stream.Close()
    m_Stream.Dispose()
    End If
    m_Stream = Nothing
    m_DataGrid.IsLoading = False
    DataValue = Nothing
    'DataView = Nothing
    'ItemsSource = Nothing
    XmlSettings = Nothing
    ColumnBinding = Nothing
    DataGridColumn = Nothing
    End Try
    End Sub
    Krishna

    Hi,
    i have the same issue now where i need to populate the xport file name as report name. can you send me your solution please.

Maybe you are looking for