Python Forum
docx insert words of previuos paragraph on next paragraph in the same position
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
docx insert words of previuos paragraph on next paragraph in the same position
#8
Yes, I thought about the fact that the characters will be different sizes. But if you can get close to what you want first, you can tweak it to be exact.

The position, size and style of everything in a Word document is set using xml I believe.

One time I renamed a word document without the .docx ending. Try that.

You will find you have a .zip file with lots of information in the form of .xml files and various folders.

Maybe you can find the exact position of each character there, I don't know. Somehow Word must be told how and where to display what.

Then, if you take you whole page as an image, you could insert chord images over that image, using position information from the .xml data.

Here is a link on how to insert an image over an image in Python.

from PIL import Image
Or, if you can mine the exact position of each character you want from the .xml data of a .docx file, you could perhaps modify the .xml to paste your chord images over the text. There are Python modules for parsing .xml files I believe, people here will know that.

As I understand it, you only have do, re, mi, so, fa, la, ti, do. (Shades of Julie Andrews!)

Hope you can get this solved!
Reply


Messages In This Thread
RE: docx insert words of previuos paragraph on next paragraph in the same position - by Pedroski55 - Jun-20-2023, 10:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 970 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  python-docx regex : Browse the found words in turn from top to bottom Tmagpy 0 1,557 Jun-27-2022, 08:45 AM
Last Post: Tmagpy
  python-docx regex: replace any word in docx text Tmagpy 4 2,296 Jun-18-2022, 09:12 AM
Last Post: Tmagpy
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,871 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  How to add run in paragraph using python-docx? toothedsword 0 2,814 May-12-2021, 10:55 AM
Last Post: toothedsword
  Compare all words in input() to all words in file Trianne 1 2,790 Oct-05-2018, 06:27 PM
Last Post: ichabod801
  Adding a paragraph of text before an exercise oldDog 5 3,655 May-22-2018, 06:57 PM
Last Post: oldDog
  Insert using psycopg giving syntax error near "INSERT INTO" olgethorpe 4 15,707 Jul-21-2017, 07:39 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020