[Solved] Pyuno: Document length

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
imr_lor
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

[Solved] Pyuno: Document length

Post by imr_lor »

Is there a function which return the length of an document (and which is implemented in pyuno)?
Last edited by imr_lor on Wed Oct 28, 2015 5:44 pm, edited 1 time in total.
OpenOffice 3.1 on LinuxMint 17.1
User avatar
karolus
Volunteer
Posts: 1158
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Post by karolus »

Hallo

Sorry, your question seems stupid!
Document length ?
Which kind of Document ??
Which "unit" of lenght - Bytes, characters, paragraphs or something else ???

Do yourself an favour and use MRI for Objectinspection as Villeroy has already recommended to you
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
imr_lor
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Post by imr_lor »

oh sorry I meant Pages
OpenOffice 3.1 on LinuxMint 17.1
User avatar
karolus
Volunteer
Posts: 1158
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Post by karolus »

from the GUI of any writer-doc:

→Tools→AddOns→Mri...
click on Attribut `CurrentController`
click on Attribut `PageCount`

Question answered ... next Question please!
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
imr_lor
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Post by imr_lor »

does mri work with python?
and if yes then how can i youse mri in python?
OpenOffice 3.1 on LinuxMint 17.1
User avatar
karolus
Volunteer
Posts: 1158
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Post by karolus »

imr_lor wrote:does mri work with python?
and if yes then how can i youse mri in python?
MRI is written in python

called via function from "inside" soffice:

Code: Select all

from mytools_Mri import MRI as mri
...
   mri.inspect( something_special )
from an python-process "outside" soffice, extended from this answer

Code: Select all

...
createUnoService = client.ServiceManager.createInstance

mri = createUnoService("mytools.Mri")
....
    mri.inspect(something_very_special)
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
imr_lor
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Post by imr_lor »

sry this is not sufficent for me as I have to deliver a fully executable python file which runs with just an vanilla open office installation
OpenOffice 3.1 on LinuxMint 17.1
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Pyuno: Document length

Post by RoryOF »

Write your python to access the OO file's metadata. The page count is on the /File /Properties : Statistics tab. You just have to access that and retrieve the values.
 Edit: Search the Forum. A very quick search returned a file that will do all or most of what you want, but we do not do homework on the forum, so it's up to you to find it. 
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
karolus
Volunteer
Posts: 1158
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Post by karolus »

imr_lor wrote:sry this is not sufficent for me as I have to deliver a fully executable python file which runs with just an vanilla open office installation
Of course, Mri is a tool that helps real Developers writing Code, not for Copy&paste into packages of
wanna-be-developers like you...

Bye
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
imr_lor
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Post by imr_lor »

Or maybe I am just someone who is still learning things.
If you never worked with things like MRI maybe you dont know how to use them.
everyone has started as someone who doesnt know how things are working.
And when the documentation is pretty poor for people who are just getting into these things those people have to ask other people,
who know how to use those API`s / Addons to learn to do it by there own.

I can understand that it must be annoying for you to explain such simple things all the time,
but there might be people who need this help.
Its is not somebodys fault to not understand something, if they are trying to understand and learn things.
So please try to be a bit less insulting to people like me who are new!
Thank you.

Btw: Solved it by my own.
OpenOffice 3.1 on LinuxMint 17.1
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: [Solved] Pyuno: Document length

Post by hanya »

The API is well documented for other languages such as Java and Basic. Both language bindings are well match with Python's one. So most people do not need documents only for written in Python.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
User avatar
karolus
Volunteer
Posts: 1158
Joined: Sat Jul 02, 2011 9:47 am

Re: [Solved] Pyuno: Document length

Post by karolus »

Hallo
So please try to be a bit less insulting to people like me who are new!
I'm not insulting in General, only if they write stuff like:
.
which return the length of an document..
.

.
sry this is not sufficent for me...
.

...
Btw: Solved it by my own.
ROFL, for the last quote!
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
Post Reply