[ILUGC] Re: How to add Table Of Contents to a odt file using libreoffice writer python UNO ?

  • From: ARUN PALANIAPPAN <arunpalaniappan.mek@xxxxxxxxx>
  • To: ilugc@xxxxxxxxxxxxx
  • Date: Wed, 20 Jun 2018 21:22:56 +0530

Dear Shrini,
Hope you are doing good.

I am exploring on automating the ebooks making process with

libreoffice writer and python UNO.

Now I need to add Table of Contents on page 2.


I donot know how to add Table of Contents using python. But, there is a
very simple way to add Table of Contents (automated) in Libre Office.

All that you have to do is change the Style of the Chapter headings to
"Headings1". If you want to add sub chapters also, change it to
"headings2", and so on...

For instance Chapter 1: Libre Office ===> Change the style to "Headings1"
1.1 Introduction ==>  Change the style to "Headings2"
After this , you can insert the TOC from Insert ----> Table of Contents
/Index ---> Table of Contents
Select the level also. (Level 1 if you want Chapter headings alone, 2 for
sub Chapter, and so on...)
You can easily create TOC.


In case you modify the Chapter Name, the same will be automatically
reflected in TOC . (For too large files, this may not work. But, we can
update by Tools--> Update --> TOC.

For more information, refer
https://help.libreoffice.org/Writer/Creating_a_Table_of_Contents

Hope this answer helps.
-- 
Regards,
ARUN P

*A Tailor’s mistake is a Fashion But, An Engineer’s mistake is a Disaster.*

"Preserve the earth; Else we will perish"

_____________________________________
ILUGC List: //www.freelists.org/list/ilugc
ILUGC Web: http://ilugc.in/

Other related posts: