The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Export several worksheets into one PDF
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sebbey

Germany
70 Posts

Posted - 05/07/2012 :  05:44:43 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.6.0G (64bit)
Operating System: Windows 7 Professional

Hello Everyone,

I'm currently trying to export three worksheets from the same workbook into one PDF File, using the expWKS command:

expWks type:=pdf export:=5 pages:=sh1name$,sh2name$,sh3name$ filename:="TEST" path:="C:\My PDF Files";


But it somehow doesn't work out. If I try to export only one sheet (the active one) into a PDF file, it works perfectly. I should maybe mention, that the string variables used in the code are defined earlier in the script, so this shouldn't be the mistake.

Thank you in advance,
sebbey

Hideo Fujii

USA
1582 Posts

Posted - 05/07/2012 :  11:13:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi sebbey,

Does this work?

expWks type:=pdf export:=specified pages:="sh1name$ sh2name$ sh3name$" filename:="TEST" path:="C:\My PDF Files";

--Hideo Fujii
OriginLab
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/07/2012 :  12:02:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi sebbey,

This feature is not currently available....you can only export one sheet to one PDF file at a time, cannot export multiple sheets to one PDF file.

The two x-functions available for exporting worksheet are expWks and expPDFw. The former exports the visible/selected/whole worksheet to an image file including PDF, the latter exports a sheet to multi-page pdf which is useful for large sheets, but in both cases only one sheet can be exported to one file, cannot export multiple sheets to one file.

Easwar
OriginLab
Go to Top of Page

sebbey

Germany
70 Posts

Posted - 05/08/2012 :  01:39:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Guys,

unfortunately Hideo's script didn't work out. But since it's not possible to export several sheets into one PDF File, I'll keep exporting them one by one. This worked out the last time I tried.

Thanks a lot for your quick responses! This Forum has been a great help for me so far!

Sebbey
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/08/2012 :  1:54:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sebbey,

To pass multiple sheet names as a "specified sheets" string, need to separate the names using carriage return, such as this:


string sh1name$, sh2name$, sh3name$;
sh1name$="[book1]"trial run 1"!";
sh2name$="[book2]"trial run 2"!";
sh3name$="[book3]"trial run 3"!";
string str$;
str$=%(sh1name$)%(CRLF)%(sh2name$)%(CRLF)%(sh3name$);
expWks type:=pdf export:=specified pages:=str$ filename:="TEST" path:="C:\My PDF Files" overwrite:=rename;


But this will create multiple files with names Test.PDF, Test1.PDF etc so the sheet name is lost?

Perhaps the following is better, where the names are stored in a stringarray and later you can access the string array and export as pdf, with the sheet name itself used as the file name, or some variation of the code below.



stringarray sa;
sa.Add("[book1]"trial run 1"!");
sa.Add("[book2]"trial run 2"!");
sa.Add("[book3]"trial run 3"!");


loop(ii,1,sa.GetSize())
{
   expWks type:=PDF export:=specified pages:=sa.GetAT(ii)$ filename:=<sheet name> path:="C:\My PDF Files";
}


Easwar
OriginLab

P.S. When an X-function generates an error message, you can find the error code and error message using the information from this LabTalk Help File section:
http://originlab.com/www/helponline/Origin/en/Programming/mergedProjects/LabTalk/LabTalk/X-Function_Exception_Handling.html

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000