Author Topic: getText with styles  (Read 1549 times)

superspy

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
getText with styles
« on: January 30, 2014, 11:12:54 am »
Hi

I'm trying to use the getAllText() function to get the text from a frame and put it into another document.
It works, BUT...formatting is lost. Is there a way to preserve formatting?

Or alternatively is there a way to copy an entire text box with styling via a script.

Thanks in advance

ismir

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Scribus User
Re: getText with styles
« Reply #1 on: April 07, 2014, 02:01:28 am »
Hi,

you can use getFont (in a while loop through all the textframes where you get the text with getText)

Code: [Select]
font = scribus.getFont(item[0])

and when you paste your collected text in a single textframe use

Code: [Select]
scribus.setText(my_collected_text_var, item[0])
scribus.setFont(font, item[0])

item in this example is the varible given from scribus.getPageItems()
the items are textframes when item[1] == 4

regards

 

palmate