0

I want to make some advanced manipulation of Word Documents, so I got advised to use win32api instead of python-docx, but it came out that there is not wind32api for Mac, so this is not possible.

Anyway, I have Microsoft Office installed and running on my Mac, so I hope there must be some Microsoft Word native api for Mac I can use, but I can't find any reference.

I'll appreciate your help.

HuLu ViCa
  • 5,077
  • 10
  • 43
  • 93

1 Answers1

0

It's called Word VBA (Visual Basic for Applications). It's part of the default installation and the common term is for such code is "macros". Which is a bit simplified - VBA can perform very complex tasks.

What you describe in the question to which you link (knowing on which page data is located) can be done using Word VBA but

  • there is no event that triggers when Word generates a new page due to page content "overflowing"
  • it's important to realize that when a document is opened in another configuration (different machine, different printer, different printer driver...) it may not lay-out exactly the same - page and line breaks might be positioned differently.
  • How Word controls page layout (whether a cell's content or all the lines in a paragraph must stay together on a page) can be controlled through formatting commands. It would be advisable to learn about these (end-user venue!) before proceding with generating documents.
  • Use styles, not direct formatting, for generating Word document content.
Cindy Meister
  • 25,071
  • 21
  • 34
  • 43