[Solved] Pyuno: Document length

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Pyuno: Document length

Postby imr_lor » Wed Oct 28, 2015 12:01 pm

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
imr_lor
 
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Postby karolus » Wed Oct 28, 2015 12:38 pm

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 - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 845
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Postby imr_lor » Wed Oct 28, 2015 12:39 pm

oh sorry I meant Pages
OpenOffice 3.1 on LinuxMint 17.1
imr_lor
 
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Postby karolus » Wed Oct 28, 2015 12:52 pm

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 - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 845
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Postby imr_lor » Wed Oct 28, 2015 1:03 pm

does mri work with python?
and if yes then how can i youse mri in python?
OpenOffice 3.1 on LinuxMint 17.1
imr_lor
 
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Postby karolus » Wed Oct 28, 2015 1:30 pm

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   Expand viewCollapse view

from mytools_Mri import MRI as mri
...
   mri.inspect( something_special )


from an python-process "outside" soffice, extended from this answer

Code: Select all   Expand viewCollapse view
...
createUnoService = client.ServiceManager.createInstance

mri 
= createUnoService("mytools.Mri")
....
    mri.inspect(something_very_special)
AOO4, Libreoffice - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 845
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Postby imr_lor » Wed Oct 28, 2015 2:46 pm

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
imr_lor
 
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: Pyuno: Document length

Postby RoryOF » Wed Oct 28, 2015 3:25 pm

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.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28787
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Pyuno: Document length

Postby karolus » Wed Oct 28, 2015 4:04 pm

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 - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 845
Joined: Sat Jul 02, 2011 9:47 am

Re: Pyuno: Document length

Postby imr_lor » Wed Oct 28, 2015 5:43 pm

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
imr_lor
 
Posts: 23
Joined: Fri Sep 04, 2015 10:28 am

Re: [Solved] Pyuno: Document length

Postby hanya » Wed Oct 28, 2015 5:49 pm

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
hanya
Volunteer
 
Posts: 884
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: [Solved] Pyuno: Document length

Postby karolus » Wed Oct 28, 2015 6:52 pm

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 - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 845
Joined: Sat Jul 02, 2011 9:47 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest