Is it possible to name multiple sheets in Excel export?

LurkingKiwiLurkingKiwi Wellington, New Zealand
edited 8:56PM in FastReport VCL 5
When exporting to Excel 97/2000/XP using the option where each printed page becomes a new sheet in the Excel workbook (Data Grouping/Like the report), is there any way to name the sheets?
Currently they seem to be auto-numbered "Page 0", "Page 1" etc which must come from FastReport.
I have a report which generates 49 sheets, 1 per division, and it's really annoying to rename the output by hand!!

I have just tried Excel 2007 XML format (Split To Sheet/use report pages), which is similar but starts the number at "Page 1" :)

Comments

  • gpigpi
    edited 8:56PM
    FR doesn't have such feature. You need to modify FR's sources
  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited 8:56PM
    gpi wrote: »
    FR doesn't have such feature. You need to modify FR's sources
    Thanks, I did try to find the code in FR which named the sheets but didn't succeed.
  • gpigpi
    edited 8:56PM
    For example for frxExportXLSX.pas:
    var
      f, i, j, k, l, x, y, dx, dy: Integer;
      Obj: TfrxIEMObject;
      r: TfrxRect;
      MCells: array of TRect; // merged cells
      StrList: TStrings;
      StylesMap: array of Integer;
      Pictures: TList; // of TfrxIEMObject
      s: string;
      ss: TStream; // xl/worksheets/sheetXXX.xml
      style: TfrxIEMStyle;
      rotor, td: string;
      TempThousandSeparator, TempDecimalSeparator: Char;
    begin
      WriteStr(FContentTypes, '<Override PartName="/xl/worksheets/sheet' + IntToStr(m.Index) +
        '.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml' +
        '.worksheet+xml"/>');
    
      if ReportPages and (ChunkSize = 0) and not SingleSheet then
        WriteStr(FWorkbook, Format('<sheet name="%s" sheetId="%d" r:id="rId%d"/>',
          [Report.PreviewPages.Page[m.Index - 1].Name, m.Index, m.Index], SetFormat))
      else
        WriteStr(FWorkbook, Format('<sheet name="Page %d" sheetId="%d" r:id="rId%d"/>',
          [m.Index, m.Index, m.Index], SetFormat));
    
  • Good evening, I want to find the setting to break the report into a sheet, how do I do it?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.