Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 19 Apr 2024, 06:44

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 15 Aug 2018, 11:25 
Offline

Joined: 03 Aug 2018, 17:58
Posts: 6
Hi
I use ExportDBGridEhToXlsx(DBGridEh1,'ExcelExport.xlsx',[],True) to export data to excel. how can I set worksheet name?


Top
 Profile  
 
PostPosted: 25 Aug 2018, 21:34 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

Unfortunately, there is no such property for specifying a worksheet name.

You can do the following trick.

Copy file DBGridEhImpExp.pas into the folder of your project and make next changes.
(Let's say we want to change sheet1 to sheet999.)

Code:
  ArrTarget: array [1 .. 3] of string = ('styles.xml', 'theme/theme1.xml',
    'worksheets/sheet999.xml');
....
  Node.AddChild('vt:lpstr').Text := 'Sheet999';
....
  ArrAttributes: array [1 .. 11] of string = ('xl', '5', '5', '9303', '480',
    '120', '27795', '12585', 'Sheet999', '1', 'rId1');
....
  ArrExtension: array [1 .. 8] of string = ('rels', 'xml', '/xl/workbook.xml',
    '/xl/worksheets/sheet999.xml', '/xl/theme/theme1.xml', '/xl/styles.xml',
    '/docProps/core.xml', '/docProps/app.xml');
...
  FZipFileProvider.AddFile(FSheetStr, 'xl/worksheets/sheet999.xml');


As a result of the export, a new name must be assigned.


Attachments:
sshot-40.png
sshot-40.png [ 28.91 KiB | Viewed 2263 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group