Issue 126391 - race in using sdk api to set a fat border to a rectangle/range in a text table
Summary: race in using sdk api to set a fat border to a rectangle/range in a text table
Alias: None
Product: App Dev
Classification: Unclassified
Component: sdk (show other issues)
Version: 4.1.3
Hardware: PC Linux 64-bit
: P5 (lowest) Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2015-07-02 06:13 UTC by Martin
Modified: 2020-05-27 14:57 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

wrong output (9.65 KB, application/vnd.oasis.opendocument.text)
2015-07-02 06:13 UTC, Martin
no flags Details
the correct output (9.65 KB, application/vnd.oasis.opendocument.text)
2015-07-02 06:16 UTC, Martin
no flags Details
java test program (66.01 KB, application/zip)
2015-07-03 13:04 UTC, Martin
no flags Details
Document with a table and two macros (16.91 KB, application/vnd.oasis.opendocument.text)
2015-07-05 17:23 UTC, bmarcelly
no flags Details
used outborder with sleep 100 (8.76 KB, application/vnd.oasis.opendocument.text)
2015-07-06 18:34 UTC, Martin
no flags Details
file as intended when using sleep 1000 (8.76 KB, application/vnd.oasis.opendocument.text)
2015-07-06 18:38 UTC, Martin
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Martin 2015-07-02 06:13:40 UTC
Created attachment 84811 [details]
wrong output

when trying to give a cellrange in a writer table fat borderlines more lines are fattened than ordered.

inserting a sleep a more than 500 msec corrects this behaviour.
the time is dependend on at least the amount of work done to the table ahead of this (eg , when also doing cell merging and text bolding this increases to 1000 msec)

 BorderLine borderstruct = new BorderLine();
 borderstruct.Color = 0;
 borderstruct.InnerLineWidth = 50;
 borderstruct.LineDistance = 0;
 borderstruct.OuterLineWidth = 0;
xCellRange = xCellRange.getCellRangeByPosition(1, 1, 2, 2);

XPropertySet xCellProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCellRange);

xCellProperties.setPropertyValue("TopBorder", borderstruct);


xCellProperties.setPropertyValue("RightBorder", borderstruct);
xCellProperties.setPropertyValue("BottomBorder", borderstruct);
xCellProperties.setPropertyValue("LeftBorder", borderstruct);
Comment 1 Martin 2015-07-02 06:16:06 UTC
Created attachment 84812 [details]
the correct output
Comment 2 Martin 2015-07-03 09:00:02 UTC
also I noticed that opening the previous attachments from a windows pc using a00 4.1.1 both attachments look wrong!? As obvious from the code, there should be a thick line around the cellRange (1,1,2,2).
Comment 3 mroe 2015-07-03 09:19:08 UTC
Please provide a full running macro (sub/function) for testing. Best way is to include it in a macro library inside the document.
Comment 4 Martin 2015-07-03 13:04:11 UTC
Created attachment 84815 [details]
java test program

sorry, having to learn the aoo-basic proved to be to difficult without having any ide comfort or huge amounts of time. :(

Attached is the smallest netbeans/java project I could make showing the erronous behaviour. it is build from using the aoo plugin. no gui , all statics.
Comment 5 bmarcelly 2015-07-05 17:23:45 UTC
Created attachment 84817 [details]
Document with a table and two macros

Attachment 84811 [details] and attachment 84812 [details] are Writer files, extension odt is missing.

I confirm that both documents are incorrect, as seen from Windows 7. It may be due to an incorrect structure of the table after setting of borders.

Read the API documentation of BorderLine structure :
 InnerLineWidth is only used as the inner part of a double line.
 OuterLineWidth has to be used for a single line.

According to the API doc, your usage of the borders is incorrect.

My attachment FatBorders is a proof.
Macro Main1 contains the Basic equivalent to your Java code. Run it, save to another name, reload : the borders have changed.
Macro Main2 is the same, but uses OuterLineWidth instead of InnerLineWidth. This time the borders stay correct after reload.
Comment 6 Martin 2015-07-05 19:24:20 UTC
Comment on attachment 84817 [details]
Document with a table and two macros

I agree I mixed up the inner with the outer. 
Changing this however does not improve when using the java code. the race remains. ( guess basic is not fast enough?)
Comment 7 Martin 2015-07-06 18:34:53 UTC
Created attachment 84819 [details]
used outborder with sleep 100

changing to using OuterLineWidth indeed show the document on reload equivalant to what was saved, but it is still wrong when using non or little sleep
Comment 8 Martin 2015-07-06 18:38:36 UTC
Created attachment 84820 [details]
file as intended when using sleep 1000

changing to using OuterLineWidth indeed shows the document on reload equivelant to what was saved, and it is correct when using enough sleep
Comment 9 Keith N. McKenna 2020-05-27 14:57:08 UTC
As this appears not to have been ever been confirmed by another user. The use of the last confirmation field is not appropriate.