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
 Forum for Python
 Looping through objects (books)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 09/09/2021 :  11:44:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2022 (64-bit) Beta2 9.9.0.105
Windows 10 21H1 x64

Greetings!

How do I loop through Origin project objects, such and workbooks, matrix books, notes, etc. using op Python package?

Thank you.

---
Andrey

YimingChen

1621 Posts

Posted - 09/09/2021 :  3:15:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can loop through workbooks('w') matrixbooks('m') or graphs('g') using code below:

for wb in op.pages('w'): 
    print(wb.name)

Currently it doesn't support notes.

James
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/09/2021 :  11:12:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

You can loop through workbooks('w') matrixbooks('m') or graphs('g') using code below:

for wb in op.pages('w'): 
    print(wb.name)

Currently it doesn't support notes.

James



Dear James,

Thank you.
How do I delete a page?

---
Andrey
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/10/2021 :  03:57:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by AKazak

Thank you.
How do I delete a page?

---
Andrey



Good question, as this was added only recently, so in the latest version of originpro, it is

import originpro as op
wb = op.find_book()
wb.destroy()


CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/10/2021 :  04:49:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

quote:
Originally posted by AKazak

Thank you.
How do I delete a page?

---
Andrey



Good question, as this was added only recently, so in the latest version of originpro, it is

import originpro as op
wb = op.find_book()
wb.destroy()


CP



Got it!
Does destroy methods works with all data types of pages, including work and matrix books?

Can I use destroy to delete sheets?

---
Andrey
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/10/2021 :  08:37:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Got it!
Does destroy methods works with all data types of pages, including work and matrix books?

Can I use destroy to delete sheets?

---
Andrey



Yes, destroy is for page and layer(sheet) level.

CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/10/2021 :  1:53:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

quote:

Got it!
Does destroy methods works with all data types of pages, including work and matrix books?

Can I use destroy to delete sheets?

---
Andrey



Thanks!

Yes, destroy is for page and layer(sheet) level.

CP




---
Andrey
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