Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Integration > Export Report from 1C as Microsoft Office Excel

Forum

Search UsersRules
Export Report from 1C as Microsoft Office Excel
#1
Just came
Points:: 0
Joined:: Mar 24, 2020

Hello everyone!
Is there an easier way than using Microsoft Office Excel COM object to export a report from 1C in Excel format?
I can see in menu that it is possible to save as Excel2007 sheet-... (*.xlsx). How can I do the same in my own common module to use Scheduled Jobs?
Anyone can show me some code sample, pls?

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hi Cao Bao!

Please see the sample code:

Code
newSpreadsheetDocument = New SpreadsheetDocument;
   
// Here is the code that populates your report with data
   
   
TempFileName = GetTempFileName("xlsx");
   
newSpreadsheetDocument.Write(TempFileName, SpreadsheetDocumentFileType.XLSX);


Thus, first we generate a report, and then save it in the desired format.

Aleksandr

Profile
#3
Just came
Points:: 0
Joined:: Mar 24, 2020

Hi Aleksandr

Thanks so much . It's work. But I want it auto run report and save it without using any button. Do you have any way to suggest for me about it?

Profile
#4
Active user
Points:: 0
Joined:: Mar 10, 2017

Dear Cao Bao,

it depends on where/how often you want to run this procedure. You can set up an automated routine (reglament) task which will run at certain periods of time. And put the above code in this procedure.

Kind regards,
Alex

Profile
#5
Just came
Points:: 0
Joined:: Mar 24, 2020

Hi Alex Ogourok,
Thank you so much. I will research it

Profile
#6
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hi Cao Bao,

If you want to do periodic report generation, then you can use the mechanism of "Scheduled jobs".

It's necessary to create a new "Scheduled job" and create the required program code (scr.1).

Then you need to set the schedule for running this job (scr.2)

Attention! The mechanism of "Scheduled jobs" works only for the client - server architecture 1C.

Aleksandr

Profile
#7
Just came
Points:: 0
Joined:: Mar 24, 2020

Aleksandr Biryukov,
I did it and it's work. Thanks so much

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.