Hi all,
On 03/15/07 09:30, Prasenjit Paik wrote:
I have a DOC file. I want to create a sub-document from it. Say, I have a
DOC of 5 pages. I want to create a DOC out of it which could be of any of
the following depending upon the user requirement -
1> Pages 1-3
2> Pages 2-4
3> Pages 4-5
User can mention the page range.
I have written a code for it which takes care of all the above mentioned 3
cases. But the problem is that sometimes it creates the sub-document with
all the pages (i.e. 5) despite being given the page range. Please take a
look at the attached code snippet -
<snip>
One interesting thing is that sub documents can be created from simple
documents. But for complex documents (e.g. documents having header,
footer, long tables spanning multiple pages, hidden blank pages), the code
fails to produce desired results.
Could anybody please tell me where could be the mistake? Any suggestion
will be of immense help to me.
The deletion operations won't be successful if e.g., there's a table
spanning across the pages. Have a look at this example:
There's a table spanning from page 2 to page 3 and the user chooses to
get only page 1 and 2. What should happen? Should the table be cut at
the end of page 2? In this case you should use the function 'split
table' which splits the table into two tables. This is possible using
the ui, therefore it should be possible using the API (or dispatcher
API). The next step would be to delete the second table:
The algorithm for obtaining page 1-2 would look like this:
set cursor to end of page 2.
t1 = cursor.getPropertyValue( "TextTable" )
set cursor to beginning of page 3
t2 = cursor.getPropertyValue( "TextTable" )
if ( t1 && t2 && t1 == t2 )
// table spanning from page 2 to 3:
if t1 has repeated headline
// splitting is not possible if we are in a repeated headline
set cursor to next row
split table
while ( !finished )
set cursor to beginning of page 3
t2 = cursor.getPropertyValue( "TextTable" )
if !t2
delete till end of document -> finished
else if t2
// page 3 starts with a table *not* spanning from page 2
delete t2
Hope this helps,
Frank
--
Frank Meies (fme) - OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]