[Solved] Shapes location mess up in odt file

Discuss the word processor

[Solved] Shapes location mess up in odt file

Postby VictorDong » Tue Sep 15, 2020 7:54 pm

Attached file is 8.5 x 26 inches odt file. The first and second page is OK. But if I delete the third page (the last and blank page) and save it, the second page will be mess up.
I really do not know what cause this issue. I created this layout by MS VS 2010, .Net framework 4.0, VB.Net. OS is Windows 10 with latest update.
Also I try Openoffice 4.0.0 and Openoffice 3.4.1 today, I got same issue.
But I am sure this layout work in Open office 3.4.1 (5 years ago).
Attachments
D26.odt
(38.09 KiB) Downloaded 31 times
Last edited by Hagar Delest on Fri Sep 18, 2020 9:22 pm, edited 1 time in total.
Reason: tagged solved
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file.

Postby Lupp » Wed Sep 16, 2020 11:39 pm

(You posted this in the Draw section, but attached a file saved by/for Writer. The content actually has a few elements only available in text documents. It may have been created with a software not providing reasonable tools for drawing.)

The design is a perfect mess. Cannot retrace the idea behind.
What I attach in return is what I got with LibreOffice V3.3. anchoring everything actually to the page, and deleting the third page. The result was opened with LibO V 7.0.1.2, only edited the fake way, and saved again.
Now the file opens in AOO 4.1.7 rendering to something you can probably accept.
This does NOT mean that the document now has a correct structure! I would still expect it to be internally irregular.
Attachments
D26_LO33_LO70_reworked.odt
(37.35 KiB) Downloaded 17 times
On Windows 10: LibreOffice 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2930
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Shapes location mess up in odt file

Postby JeJe » Thu Sep 17, 2020 11:50 am

Here's the original reduced to two pages. This was done by inserting a manual page break on page 2 - and then going to the end and removing the extra blank pages with the backspace key.
Attachments
D26_2page.odt
(32.55 KiB) Downloaded 13 times
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1193
Joined: Wed Mar 09, 2016 2:40 pm

Re: Shapes location mess up in odt file

Postby VictorDong » Thu Sep 17, 2020 3:06 pm

This file was created by programming. (VB.Net and Automation interface)
Such as:
m_oDoc = m_oDesk.loadComponentFromURL("private:factory/swriter", "_blank", 0, OpenPar)

I created thousands files 5 years ago. All files were fine before. But I open these files couple days ago and found all layout mess up.
So I try recreate one layout and found I insert a blank file at the and to avoid this issue.
Also I open these files by Openoffice 4.1.7, 4.0.0 and 3.4.1 and got same issue now.
I guess that one Windows 10 update cause this trouble. But I need find a way to create thousands layout automatically by programming for election.
I do not know which forum I suppose to post this question.

Thank You.
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file

Postby JeJe » Thu Sep 17, 2020 3:23 pm

Is the problem that you have thousands of files like the one posted which have an extra page you want to remove?

Or do the thousands of files have a different problem - which you've partly fixed in that file? If so what is one of the original files like and what's the problem with it?
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1193
Joined: Wed Mar 09, 2016 2:40 pm

Re: Shapes location mess up in odt file

Postby VictorDong » Thu Sep 17, 2020 3:31 pm

All files got same problem that the second page mess up. But all these file were fine 5 years ago.
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file

Postby JeJe » Thu Sep 17, 2020 3:43 pm

So I try recreate one layout and found I insert a blank file at the and to avoid this issue.


I'm confused by that. Is the file you posted a modified version of one of the thousands of files or not?

If so, post one of the original thousands of files and tell us what the problem with that is - what exactly the 'mess up' is with that.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1193
Joined: Wed Mar 09, 2016 2:40 pm

Re: Shapes location mess up in odt file

Postby VictorDong » Thu Sep 17, 2020 3:51 pm

Attached file is the original file that I create 5 years ago. The second page mess up now.
Last week I recreate D26.odt file that I uploaded at the first post.
Attachments
DB1.odt
(32.51 KiB) Downloaded 18 times
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file

Postby JeJe » Thu Sep 17, 2020 4:16 pm

That file looks like this on my machine in print preview - is that how its meant to look?

filedb1.JPG


If so, post how it looks on yours. And instead of trying to alter the files you should be looking for something else. Maybe this is something to do with your printer settings, something like that?
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1193
Joined: Wed Mar 09, 2016 2:40 pm

Re: Shapes location mess up in odt file

Postby VictorDong » Thu Sep 17, 2020 4:22 pm

Attached file is printing preview on my PC.
The file is good on your PC.
Attachments
DB1Preview.png
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file

Postby RoryOF » Thu Sep 17, 2020 4:35 pm

I am getting a result similar to VictorDong, except the boxes on top of his page 2 are in the desktop below page1 and are difficult of access (I am using a pre-release version of OpenOffice).

My memory is that OpenOffice Writer will not accept a text width greater than 68 cm; it may be that this also applies to a text area height on a page. It may be better to configure that file for Draw, which allows a 300 cm x 300 cm page size.
Apache OpenOffice 4.1.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31558
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Shapes location mess up in odt file

Postby Bill » Thu Sep 17, 2020 7:52 pm

The objects on the second page are anchored to the first page with a vertical position setting which would place them near the bottom of the first page. I suspect that is why the objects on the second page are misplaced. When I opened the document with LO, it did not show any text at all on the second page when it was opened. I never had to delete the third page to make the text disappear. Anchoring the objects on the second page to the second page will probably solve the problem.

Edit: Lupp has already done this for you. See the reworked document he uploaded.
Last edited by Bill on Thu Sep 17, 2020 8:08 pm, edited 1 time in total.
AOO 4.1.7 on Manjaro Cinnamon
Bill
Volunteer
 
Posts: 7921
Joined: Sat Nov 24, 2007 6:48 am

Re: Shapes location mess up in odt file

Postby RoryOF » Thu Sep 17, 2020 8:06 pm

My advice would be, if possible, to truncate column 2 and wrap the extra text to the top of column 3, and shorten the page height.
Apache OpenOffice 4.1.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31558
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Shapes location mess up in odt file

Postby VictorDong » Thu Sep 17, 2020 8:43 pm

Hi RoryOF and Bill,
Thank you for your help.
I must create all ballot layout by my software automatically base on election database. Cannot modify them manually.
Also the ballot length vary from A4 to 26". All shapes are anchor to page 2 on the second page before save it in my software.
But when I open it later all shapes go to the bottom of the first page that seem they anchor to the first page. It changed by itself. I have nothing can do in programming right now.

Thanks
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: Shapes location mess up in odt file

Postby JeJe » Thu Sep 17, 2020 11:05 pm

I have Windows 8 and OO 4.1.6 - wouldn't know if there's a difference between 4.1.6 and 4.1.7 here.

Changing the anchor page number is easy. This code changes all the anchors to page 2 and deletes the added page in file D26.odt.

Code: Select all   Expand viewCollapse view


Sub Main
dpage = thiscomponent.drawpage
for i = 0 to dpage.count - 1 'anchor all to the second page
dpage.getbyindex(0).AnchorPageNo = 2
next

thiscomponent.currentcontroller.select(thiscomponent.text.getend) 'remove the added page in "D26.odt"
vc= thiscomponent.currentcontroller.viewcursor
vc.goleft(1,true)
vc.string= ""

End Sub

Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1193
Joined: Wed Mar 09, 2016 2:40 pm

Re: Shapes location mess up in odt file

Postby Bill » Fri Sep 18, 2020 3:40 am

VictorDong wrote:All shapes are anchor to page 2 on the second page before save it in my software.
But when I open it later all shapes go to the bottom of the first page that seem they anchor to the first page. It changed by itself.

Does your software display the anchor on page 2? If not, how do you know the anchor is on page 2? I've never seen AOO spontaneously move an anchor to a different page.
AOO 4.1.7 on Manjaro Cinnamon
Bill
Volunteer
 
Posts: 7921
Joined: Sat Nov 24, 2007 6:48 am

Re: Shapes location mess up in odt file

Postby VictorDong » Fri Sep 18, 2020 7:38 pm

Finally I fix this issue base on JeJe idea.

Old way is:
oShape.VertOrientPosition = sngTop + (m_lngPage) * (m_lngPageHeight)

New way is:
oShape.VertOrientPosition = sngTop
oShape.AnchorPageNo = m_lngPage + 1

Old way only work on old Windows 10 version system.
Attached is new ballot layout.

Thanks everyone for your help.

Have nice one.
Attachments
DB26.odt
(38.11 KiB) Downloaded 15 times
Openoffice 4.1.7
Windows 10 Pro + Latest Update
MS VS 2010. .Net Framework 4.0
VictorDong
 
Posts: 7
Joined: Tue Sep 15, 2020 7:36 pm

Re: [Solved] Shapes location mess up in odt file

Postby Bill » Fri Sep 18, 2020 11:00 pm

That's much better. The anchor for the draw objects on the second page are now on the second page. The draw objects on the second page which LO was not displaying on the other documents are now displaying in the new document. The only problem I am still seeing is in LO 7.0.1.2. Any time I try to scroll any of the documents, my CPU pegs at 100% for some time and both LO and the computer become unresponsive. I'm not sure if this is a bug or some compatibility issue on my system. LO 6.3.6.2 and AOO 4.1.7 do not have this problem.
AOO 4.1.7 on Manjaro Cinnamon
Bill
Volunteer
 
Posts: 7921
Joined: Sat Nov 24, 2007 6:48 am

Re: [Solved] Shapes location mess up in odt file

Postby Lupp » Sat Sep 19, 2020 1:15 am

I wouldn't expect the above attached odt-file to have a consistent structure. The contiguous larger parts of the ballot have a colored header each followed by constructs consisting of a textbox and a little rectangle (though called "OVAL"). Neither are the textboxes and the related shapes correctly grouped, nor do they have a consistent Z-order as far as I can see. The complete contiguous part is covered by a rectangular shape again - without grouping. It's at the front (nearest to the user by Z-order) of the range, and directly selectable by a click. However, it has Fill=Color (White) and Transparency=0. Nonetheless it is tranparent as we can see.
There are contradictions. The file is corrupted in an unclear way. It cannot be trusted concerning anything what should be based on it. Surely it cannot be used for ballots (automtic evaluation to fear for) in an official election. If this is "digitalization" we should de-digitalize.
On Windows 10: LibreOffice 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2930
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] Shapes location mess up in odt file

Postby Bill » Sat Sep 19, 2020 10:47 am

Lupp wrote:The complete contiguous part is covered by a rectangular shape again - without grouping. It's at the front (nearest to the user by Z-order) of the range, and directly selectable by a click. However, it has Fill=Color (White) and Transparency=0. Nonetheless it is tranparent as we can see.

It isn't transparent. If you right-click the rectangular shape and select "Arrange", the last option in the context menu is "To Foreground", so the rectangular shape is in the background and doesn't cover the objects which are in the foreground. Click "To Foreground" to bring the rectangular shape to the foreground, then the rectangular shape can cover the other objects.
AOO 4.1.7 on Manjaro Cinnamon
Bill
Volunteer
 
Posts: 7921
Joined: Sat Nov 24, 2007 6:48 am

Re: [Solved] Shapes location mess up in odt file

Postby Lupp » Sat Sep 19, 2020 12:01 pm

A shape in the background shouldn't be selectable by a click into the area where it is covered by other shapes.
As I already mentioned, the white shape used like a frame is selectable this way: First inconsistency.

If you accept the suggestion 'To Foreground' the white area actually hides the other shapes.
Now you cannot Undo this change: Second Inconsistency.

If you send the shape 'To Background' again, its area is again selectable with the mouse: Third inconsistency.

To get access to the shapes behind, you may either delete the above discussed shape, or set its area explicitly to 'None'.
Reverting this step (second alternative) you get the old inconsistent behaviour again.

Having accessed one of the entries, and having removed the "OVAL" (actually a rectangle), you get a kind of TextBox with a kind of left indentation. As soon as you enter it for editing, a special kind of frame shows up limiting the text range regarding the indentation.
Can you show me UI means of AOO or LibO to get such a TextBox or to change the indentation?

Research with the help of a macro shows me that there is a property TextLeftDistance set to 847 (the unit used is obviously 1/100 mm). I never found mentioned this concerning the AOO or LibO UI. It may have been implemented to enhance compatibility with MS Word to some degree. But even if I use that property by macro for a TextBox created with LibO, I get different behaviour as compared to the imported TextBox. There must be something else. Please tell me how it actually is.
On Windows 10: LibreOffice 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2930
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] Shapes location mess up in odt file

Postby Bill » Sat Sep 19, 2020 2:28 pm

Lupp wrote:A shape in the background shouldn't be selectable by a click into the area where it is covered by other shapes.
As I already mentioned, the white shape used like a frame is selectable this way: First inconsistency.

It appears that when clicking overlapping objects, the object with the highest z-index is the one that is selected. Moving an object from foreground to background does not change the z-index for the object. I don't know if this is the way it's supposed to work. If not, then it's a bug.

Lupp wrote:If you accept the suggestion 'To Foreground' the white area actually hides the other shapes.
Now you cannot Undo this change: Second Inconsistency.

Looks like a bug to me.

Lupp wrote:If you send the shape 'To Background' again, its area is again selectable with the mouse: Third inconsistency.

Yes, because the z-index has not changed.

Lupp wrote:To get access to the shapes behind, you may either delete the above discussed shape, or set its area explicitly to 'None'.
Reverting this step (second alternative) you get the old inconsistent behaviour again.

Use the "Send to back" option to change the z-index to "0" and the foreground objects can then be selected.

Lupp wrote:Having accessed one of the entries, and having removed the "OVAL" (actually a rectangle), you get a kind of TextBox with a kind of left indentation. As soon as you enter it for editing, a special kind of frame shows up limiting the text range regarding the indentation.
Can you show me UI means of AOO or LibO to get such a TextBox or to change the indentation?

The Text Box tool is on the Drawing Toolbar.

Lupp wrote:Research with the help of a macro shows me that there is a property TextLeftDistance set to 847 (the unit used is obviously 1/100 mm). I never found mentioned this concerning the AOO or LibO UI. It may have been implemented to enhance compatibility with MS Word to some degree. But even if I use that property by macro for a TextBox created with LibO, I get different behaviour as compared to the imported TextBox. There must be something else. Please tell me how it actually is.

Right-click one of the Text boxes and select Text. Click the Text tab. The Left "Spacing to borders" setting on my system is .33" which is close to the 847 (8.47mm) "TextLeftDistance" setting.
AOO 4.1.7 on Manjaro Cinnamon
Bill
Volunteer
 
Posts: 7921
Joined: Sat Nov 24, 2007 6:48 am


Return to Writer

Who is online

Users browsing this forum: No registered users and 18 guests