Ask Your Question

Why does setting a frame's relative width not work?

asked 2017-05-22 18:26:57 +0200

ksten gravatar image

I'm generating a frame like so:

    XTextFrame frame = UnoRuntime.queryInterface(XTextFrame.class, serviceFactory.createInstance(""));
    text.insertTextContent(cursor, frame, false);
    XPropertySet properties = UnoRuntime.queryInterface(XPropertySet.class, frame);
    properties.setPropertyValue("AnchorType", TextContentAnchorType.AT_PAGE);
    properties.setPropertyValue("VertOrient", VertOrientation.CENTER);
    properties.setPropertyValue("VertOrientRelation", RelOrientation.PRINT_AREA);
    properties.setPropertyValue("HoriOrient", HoriOrientation.CENTER);
    properties.setPropertyValue("HoriOrientRelation", RelOrientation.PRINT_AREA);

    properties.setPropertyValue("Width", 15000);
//    properties.setPropertyValue("RelativeWidthRelation", RelOrientation.PRINT_AREA);
//    properties.setPropertyValue("RelativeWidth", 100);

If I comment out the "Width" setting line and uncomment the relative width setting lines, the frame shows up as 1 character wide. I've tried all the different RelOrientation values but none of them make any difference. What do I need to do to get the frame sized as 100% of the printable area on the page?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-05-24 05:47:54 +0200

Ratslinger gravatar image

updated 2017-05-24 06:43:31 +0200

I have no problems with this using Basic or Python. Text frame shows across entire width. However I do not see where 'cursor' is created. Something such as (not sure of Java syntax - "XTextDocument document = getDocument();):

cursor = document.Text.createTextCursor() with that going before text.insertTextContent(cursor, frame, false); and move both lines to after all properties have been set.

Just noticed, don't see where "text" is created - sb something like "text = document.Text"

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-22 18:26:57 +0200

Seen: 68 times

Last updated: May 24 '17