Export Report from 1C as Microsoft Office Excel

1C:Enterprise platform integration capabilities and techniques

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Mar 24, 2020
Company: 1C Innovation

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?

 
#2
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

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

 
#3
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Mar 24, 2020
Company: 1C Innovation

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?

Edited: Cao Bao - Mar 26, 2020 07:05 AM
 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 10, 2017
Company: Rufinor

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

 
#5
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Mar 24, 2020
Company: 1C Innovation

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

 
#6
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

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

Download 1.png (39.77 KB)
Download 2.png (45.2 KB)
 
#7
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Mar 24, 2020
Company: 1C Innovation

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

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.