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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Export several worksheets into one PDF

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
sebbey Posted - 05/07/2012 : 05:44:43 AM
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
4   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 05/08/2012 : 1:54:28 PM
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

sebbey Posted - 05/08/2012 : 01:39:14 AM
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
easwar Posted - 05/07/2012 : 12:02:33 PM
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
Hideo Fujii Posted - 05/07/2012 : 11:13:51 AM
Hi sebbey,

Does this work?

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

--Hideo Fujii
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000