Here is the output I capture from the println statements:

height: 0
AnchorPageNo: 1
AnchorType: com.sun.star.text.textcontentanchort...@39060b
VertOrient: 0
HoriOrient: 0
VertOrientPosition: 0
HoriOrientPosition: 1000
HoriOrientRelation: 8
VertOrientRelation: 8
height: 21500
AnchorPageNo: 2
AnchorType: com.sun.star.text.textcontentanchort...@39060b
VertOrient: 0
HoriOrient: 0
VertOrientPosition: 21500
HoriOrientPosition: 1000
HoriOrientRelation: 8
VertOrientRelation: 8
 
height: 43000
AnchorPageNo: 3
AnchorType: com.sun.star.text.textcontentanchort...@39060b
VertOrient: 0
HoriOrient: 0
VertOrientPosition: 43000
HoriOrientPosition: 1000
HoriOrientRelation: 8
VertOrientRelation: 8



Chris Fleischmann wrote:
> 
> I'm sorry but your last comment lost me...
> 
> Here is my Java method to create the necessary pages and to move the
> textframes (well trying to):
> 
> private void moveTextFrames() {
>         XTextFramesSupplier xTextFramesSupplier = (XTextFramesSupplier)
>                 UnoRuntime.queryInterface(XTextFramesSupplier.class,
> xWriterComponent_dest);
> 
>         XNameAccess xNamedFrames = xTextFramesSupplier.getTextFrames();
> 
>         XIndexAccess xIndexAccess = (XIndexAccess)
>                 UnoRuntime.queryInterface(
>                 XIndexAccess.class, xNamedFrames);
> 
>         XTextContent xFrameContent[] = new
> XTextContent[xIndexAccess.getCount()];
>         XPropertySet xShapeProps[] = new
> XPropertySet[xIndexAccess.getCount()];
> 
>         XText xText = xTextDocument_dest.getText();
> 
>         XController xController_targetDoc =
> xTextDocument_dest.getCurrentController();
> 
>         // the cursor for the source document
>         XTextViewCursorSupplier xViewCursorSupplier_targetDoc =
>                 (XTextViewCursorSupplier)
>                 UnoRuntime.queryInterface(XTextViewCursorSupplier.class,
>                 xController_targetDoc);
> 
>         //selecting the whole source document
>         XTextViewCursor xTextViewCursor_targetDoc =
>                 xViewCursorSupplier_targetDoc.getViewCursor();
> 
>         XPageCursor xPageCursor =
>                 (XPageCursor) UnoRuntime.queryInterface(
>                 XPageCursor.class,
>                 xTextViewCursor_targetDoc);
> 
>         xPageCursor.jumpToFirstPage();
>         xPageCursor.jumpToEndOfPage();
> 
>         for (int i = 0; i < xIndexAccess.getCount(); i++) {
>             try {
>                 xPageCursor.jumpToLastPage();
>                 xPageCursor.jumpToEndOfPage();
> 
>                 // Insert a paragraph break into the document (not the
> frame)
>                 xText.insertControlCharacter(xTextViewCursor_targetDoc,
> ControlCharacter.PARAGRAPH_BREAK, false);
> 
>                 XPropertySet xCursorProps =
> (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
> xTextViewCursor_targetDoc);
> 
>                 xCursorProps.setPropertyValue("BreakType",
> com.sun.star.style.BreakType.PAGE_AFTER);
> 
>                 xText.insertControlCharacter(xTextViewCursor_targetDoc,
> ControlCharacter.PARAGRAPH_BREAK, false);
>             } catch (Exception e) {
>                 System.out.println(e.getMessage());
> 
>                 e.printStackTrace();
>             }
>         }
> 
>         xPageCursor.jumpToFirstPage();
>         
>         for (int i = 0; i < xIndexAccess.getCount(); i++) {
>             try {
>                 Any xImageAny = (Any) xIndexAccess.getByIndex(i); 
>                 Object textFrame = xImageAny.getObject();
> 
>                 xFrameContent[i] = (XTextContent)textFrame;
> 
>                 xShapeProps[i] = (XPropertySet)
> UnoRuntime.queryInterface(XPropertySet.class, textFrame);
> 
>                 int height = xTextViewCursor_targetDoc.getPosition().Y;
> 
>                 xShapeProps[i].setPropertyValue("AnchorPageNo", new
> Short((short)(i + 1)));
> 
>                 System.out.println("AnchorPageNo: " +
> xShapeProps[i].getPropertyValue("AnchorPageNo"));
> 
>                 xShapeProps[i].setPropertyValue("AnchorType",
> TextContentAnchorType.AT_PAGE);
> 
>                 System.out.println("AnchorType: " +
> xShapeProps[i].getPropertyValue("AnchorType"));
> 
>                 xShapeProps[i].setPropertyValue("VertOrient", new
> Short(VertOrientation.NONE));
> 
>                 System.out.println("VertOrient: " +
> xShapeProps[i].getPropertyValue("VertOrient"));
> 
>                 xShapeProps[i].setPropertyValue("HoriOrient", new
> Short(HoriOrientation.NONE));
> 
>                 System.out.println("HoriOrient: " +
> xShapeProps[i].getPropertyValue("HoriOrient"));
>                 
>                 xShapeProps[i].setPropertyValue("VertOrientPosition", new
> Integer(height));
> 
>                 System.out.println("VertOrientPosition: " +
> xShapeProps[i].getPropertyValue("VertOrientPosition"));
> 
>                 xShapeProps[i].setPropertyValue("HoriOrientPosition", new
> Integer(1000));
> 
>                 System.out.println("HoriOrientPosition: " +
> xShapeProps[i].getPropertyValue("HoriOrientPosition"));
> 
>                 xShapeProps[i].setPropertyValue("HoriOrientRelation", new
> Short(RelOrientation.PAGE_PRINT_AREA));
> 
>                 System.out.println("HoriOrientRelation: " +
> xShapeProps[i].getPropertyValue("HoriOrientRelation"));
> 
>                 xShapeProps[i].setPropertyValue("VertOrientRelation", new
> Short(RelOrientation.PAGE_PRINT_AREA));
> 
>                 System.out.println("VertOrientRelation: " +
> xShapeProps[i].getPropertyValue("VertOrientRelation"));
> 
>                 // Set the width and height of the shape.
>                 xShapeProps[i].setPropertyValue("FrameWidthAbsolute", new
> Integer(frame_size.Width));
>                 xShapeProps[i].setPropertyValue("FrameHeightAbsolute", new
> Integer(frame_size.Height));
> 
>                 xShapeProps[i].setPropertyValue("FrameIsAutomaticHeight",
> new Boolean(false));
>                 xShapeProps[i].setPropertyValue("SizeType", new
> Short((short)1));
> 
>                 xShapeProps[i].setPropertyValue("LeftBorderDistance", new
> Integer(200));
>                 xShapeProps[i].setPropertyValue("RightBorderDistance", new
> Integer(200));
>                 xShapeProps[i].setPropertyValue("TopBorderDistance", new
> Integer(200));
>                 xShapeProps[i].setPropertyValue("BottomBorderDistance",
> new Integer(200));
> 
>                 xPageCursor.jumpToNextPage();
>                 
>             } catch (Exception e) { 
>                 System.out.println(e.getMessage());
>                 
>                 e.printStackTrace();
>             }
>         }
>     }
> 
> The pages are created without any issues... The output as per my println
> statements shows correct page and heights assuming the first page top,
> left is 0/0.
> 
> Basically, what I can do is move the text frame without any issues using
> the VertOrientPosition and HoriOrientPosition as long as the boundaries
> for the textframe don't go out of the first page... Meaning I can get the
> textframes to move around on page 1 no problem... but trying to anchor
> them on to subsequent pages at the same x/y coordinate on the page isn't
> working.
> 
> Again, see attached odt.  http://www.nabble.com/file/p24177299/test.odt
> test.odt 
> 
> 
> Fernand Vanrie wrote:
>> 
>> Chris ,
>> 
>> Before you start placing Frames, you must been sure you have already 
>> created the right number of pages.
>> 
>> anyhow: i placed some code in your documents  "standard basic libray 
>> module1"
>> this code placed a 1000x1000 frame at the cusor position,you moves your 
>> cursor to the right position, or you  gives  fixed coordinates to 
>> replace the cursor position and translates to java :-)
>> Fernand
>> 
>>> Thanks for the tips... my method is now;
>>>
>>> private void moveTextFrames() {
>>>         XTextFramesSupplier xTextFramesSupplier = (XTextFramesSupplier)
>>>                 UnoRuntime.queryInterface(XTextFramesSupplier.class,
>>> xWriterComponent_dest);
>>>
>>>         XNameAccess xNamedFrames = xTextFramesSupplier.getTextFrames();
>>>
>>>         XIndexAccess xIndexAccess = (XIndexAccess)
>>>                 UnoRuntime.queryInterface(
>>>                 XIndexAccess.class, xNamedFrames);
>>>
>>>         XTextContent xFrameContent[] = new
>>> XTextContent[xIndexAccess.getCount()];
>>>         XPropertySet xShapeProps[] = new
>>> XPropertySet[xIndexAccess.getCount()];
>>>
>>>         XText xText = xTextDocument_dest.getText();
>>>
>>>         XController xController_targetDoc =
>>> xTextDocument_dest.getCurrentController();
>>>
>>>         // the cursor for the source document
>>>         XTextViewCursorSupplier xViewCursorSupplier_targetDoc =
>>>                 (XTextViewCursorSupplier)
>>>                 UnoRuntime.queryInterface(XTextViewCursorSupplier.class,
>>>                 xController_targetDoc);
>>>
>>>         //selecting the whole source document
>>>         XTextViewCursor xTextViewCursor_sourceDoc =
>>>                 xViewCursorSupplier_targetDoc.getViewCursor();
>>>
>>>         /*
>>>         XPageCursor xPageCursor =
>>>                 (XPageCursor) UnoRuntime.queryInterface(
>>>                 XPageCursor.class,
>>>                 xTextViewCursor_sourceDoc);
>>>         */
>>>
>>>         for (int i = 0; i < xIndexAccess.getCount(); i++) {
>>>             try {
>>>                 Any xImageAny = (Any) xIndexAccess.getByIndex(i); 
>>>                 Object textFrame = xImageAny.getObject();
>>>
>>>                 xFrameContent[i] = (XTextContent)textFrame;
>>>
>>>                 xShapeProps[i] = (XPropertySet)
>>> UnoRuntime.queryInterface(XPropertySet.class, textFrame);
>>>
>>>                 // Setting the vertical and horizontal position
>>>                 long height = (i * page_size.Height) + 1000;
>>>
>>>                 System.out.println("height: " + height);
>>>
>>>                 // Setting the vertical and horizontal position
>>>
>>>                 xShapeProps[i].setPropertyValue("AnchorPageNo", new
>>> Short((short)(i + 1)));
>>>                 
>>>                 xShapeProps[i].setPropertyValue("AnchorType",
>>> TextContentAnchorType.AT_PAGE);
>>>
>>>                 xShapeProps[i].setPropertyValue("VertOrient", new
>>> Short(VertOrientation.NONE));
>>>                 xShapeProps[i].setPropertyValue("HoriOrient", new
>>> Short(HoriOrientation.NONE));
>>>                 xShapeProps[i].setPropertyValue("VertOrientPosition",
>>> new
>>> Long(height));
>>>                 xShapeProps[i].setPropertyValue("HoriOrientPosition",
>>> new
>>> Integer(1000));
>>>
>>>                 xShapeProps[i].setPropertyValue("HoriOrientRelation",
>>> (short)50);
>>>                 xShapeProps[i].setPropertyValue("VertOrientRelation",
>>> (short)50);
>>>
>>>                 // Set the width and height of the shape.
>>>                 xShapeProps[i].setPropertyValue("FrameWidthAbsolute",
>>> new
>>> Integer(frame_size.Width));
>>>                 xShapeProps[i].setPropertyValue("FrameHeightAbsolute",
>>> new
>>> Integer(frame_size.Height));
>>>
>>>                
>>> xShapeProps[i].setPropertyValue("FrameIsAutomaticHeight",
>>> new Boolean(false));
>>>                 xShapeProps[i].setPropertyValue("SizeType", new
>>> Short((short)1));
>>>
>>>                 xShapeProps[i].setPropertyValue("LeftBorderDistance",
>>> new
>>> Integer(200));
>>>                 xShapeProps[i].setPropertyValue("RightBorderDistance",
>>> new
>>> Integer(200));
>>>                 xShapeProps[i].setPropertyValue("TopBorderDistance", new
>>> Integer(200));
>>>                 xShapeProps[i].setPropertyValue("BottomBorderDistance",
>>> new
>>> Integer(200));
>>>
>>>                 // Insert a paragraph break into the document (not the
>>> frame)
>>>                 xText.insertControlCharacter(xTextViewCursor_sourceDoc,
>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>
>>>                 XPropertySet xCursorProps =
>>> (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
>>> xTextViewCursor_sourceDoc);
>>>
>>>                 xCursorProps.setPropertyValue("BreakType",
>>> com.sun.star.style.BreakType.PAGE_AFTER);
>>>
>>>                 xText.insertControlCharacter(xTextViewCursor_sourceDoc,
>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>                 // xTextCursor.collapseToEnd();
>>>                 
>>>             } catch (Exception e) { 
>>>                 System.out.println(e.getMessage());
>>>                 
>>>                 e.printStackTrace();
>>>             }
>>>         }
>>>     }
>>>
>>>
>>> With your code, are you coming from the "bottom" of your document and
>>> working your way up?
>>>
>>> I also don't believe I need;
>>>
>>> PositionProtected = False
>>> SizeProtected = false
>>> ContentProtected = false
>>>
>>> But still it doesn't work... :(
>>>
>>> See attachment,  http://www.nabble.com/file/p24164747/text.odt text.odt 
>>>
>>> I als notice that there seems to be issues with the longs, ints, shorts
>>> etc... as also captured here:
>>> http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=16089
>>>
>>> Any other thoughts?
>>>
>>> Thanks in advance
>>>
>>>
>>> Fernand Vanrie wrote:
>>>   
>>>> Chris ,
>>>>
>>>> Long is needed because integer is to small and there are different 
>>>> properties who has to been set properly.
>>>>
>>>>  Please find the basic code i uses to place Frames without any problem
>>>>
>>>>  iPagenr = oViewCursor.page
>>>>     iHCpos = oViewCursor.getPosition().X
>>>>     iVCpos = oViewCursor.getPosition().Y  - (30700 * (iPagenr -1)) ' 
>>>> Vieuwcursor rekend steeds van begin van document
>>>>   
>>>>      oFrame.SetPropertyValue("AnchorPageNo", iPagenr)
>>>>     oFrame.AnchorType = lAnchor
>>>>     oFrame.PositionProtected = False
>>>>     oFrame.SizeProtected = false
>>>>     oFrame.ContentProtected = false
>>>>      oFrame.HoriOrient = NONE
>>>>      oFrame.VertOrient = NONE
>>>>      oFrame.VertOrientRelation = PAGE_PRINT_AREA  
>>>>      oFrame.HoriOrientRelation = PAGE_PRINT_AREA
>>>>
>>>>      oText.insertTextContent(oCursor(), oFrame, false)
>>>>
>>>> hope i  helps
>>>>
>>>> Fernand
>>>>     
>>>>> Hi, Yes, I am trying to calculate the height like so,
>>>>>
>>>>> (i * page_size.Height) + 1000
>>>>>
>>>>> The page_size.Height was calculated previously, ie.,
>>>>>
>>>>> XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier) 
>>>>>                    
>>>>> UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
>>>>> xTextDocument_dest);
>>>>>
>>>>>             // get the NameAccess interface from the Style family
>>>>> collection
>>>>>             XNameAccess xNameAccess = xSupplier.getStyleFamilies();
>>>>>
>>>>>             XNameContainer xPageStyleCollection = (XNameContainer)
>>>>>                     UnoRuntime.queryInterface(XNameContainer.class,
>>>>> xNameAccess.getByName(
>>>>>                     "PageStyles"));
>>>>>
>>>>>             // create a PropertySet to set the properties for the new
>>>>> Pagestyle
>>>>>             XPropertySet xPropertySet = (XPropertySet)
>>>>> UnoRuntime.queryInterface(XPropertySet.class,
>>>>>                     xPageStyleCollection.getByName("Default"));
>>>>>
>>>>>             // Flip the size
>>>>>             page_size = (Size) xPropertySet.getPropertyValue("Size");
>>>>>
>>>>>             int height = page_size.Height;
>>>>>             page_size.Height = page_size.Width;
>>>>>             page_size.Width = height;
>>>>>
>>>>>
>>>>> I have also tried the following:
>>>>>
>>>>> private void moveTextFrames() {
>>>>>         XTextFramesSupplier xTextFramesSupplier =
>>>>> (XTextFramesSupplier)
>>>>>                 UnoRuntime.queryInterface(XTextFramesSupplier.class,
>>>>> xWriterComponent_dest);
>>>>>
>>>>>         XNameAccess xNamedFrames =
>>>>> xTextFramesSupplier.getTextFrames();
>>>>>
>>>>>         XIndexAccess xIndexAccess = (XIndexAccess)
>>>>>                 UnoRuntime.queryInterface(
>>>>>                 XIndexAccess.class, xNamedFrames);
>>>>>
>>>>>         XTextContent xFrameContent[] = new
>>>>> XTextContent[xIndexAccess.getCount()];
>>>>>         XPropertySet xShapeProps[] = new
>>>>> XPropertySet[xIndexAccess.getCount()];
>>>>>
>>>>>         XText xText = xTextDocument_dest.getText();
>>>>>
>>>>>         XTextCursor xTextCursor = xText.createTextCursor();
>>>>>
>>>>>         for (int i = 0; i < xIndexAccess.getCount(); i++) {
>>>>>             try {
>>>>>                 Any xImageAny = (Any) xIndexAccess.getByIndex(i); 
>>>>>                 Object textFrame = xImageAny.getObject();
>>>>>
>>>>>                 xFrameContent[i] = (XTextContent)textFrame;
>>>>>
>>>>>                 xShapeProps[i] = (XPropertySet)
>>>>> UnoRuntime.queryInterface(XPropertySet.class, textFrame);
>>>>>
>>>>>                 xShapeProps[i].setPropertyValue("AnchorType",
>>>>> TextContentAnchorType.AT_PAGE);
>>>>>
>>>>>                 // Setting the vertical and horizontal position
>>>>>                 long height = (i * page_size.Height) + 1000;
>>>>>
>>>>>                 //xShapeProps.setPropertyValue("VertOrient", new
>>>>> Short(VertOrientation.NONE));
>>>>>                 //xShapeProps.setPropertyValue("HoriOrient", new
>>>>> Short(HoriOrientation.NONE));
>>>>>                 //xShapeProps.setPropertyValue("HoriOrientPosition",
>>>>> new
>>>>> Integer(1000));
>>>>>                 xShapeProps[i].setPropertyValue("VertOrientPosition",
>>>>> height);
>>>>>
>>>>>                 // Set the width and height of the shape.
>>>>>                 //xShapeProps.setPropertyValue("FrameWidthAbsolute",
>>>>> new
>>>>> Integer(frame_size.Width));
>>>>>                 //xShapeProps.setPropertyValue("FrameHeightAbsolute",
>>>>> new
>>>>> Integer(frame_size.Height));
>>>>>                
>>>>> //xShapeProps.setPropertyValue("FrameIsAutomaticHeight",
>>>>> new
>>>>> Boolean(false));
>>>>>                 //xShapeProps.setPropertyValue("SizeType", new
>>>>> Short((short)1));
>>>>>
>>>>>                 //xShapeProps.setPropertyValue("LeftBorderDistance",
>>>>> new
>>>>> Integer(200));
>>>>>                 //xShapeProps.setPropertyValue("RightBorderDistance",
>>>>> new
>>>>> Integer(200));
>>>>>                 //xShapeProps.setPropertyValue("TopBorderDistance",
>>>>> new
>>>>> Integer(200));
>>>>>                 //xShapeProps.setPropertyValue("BottomBorderDistance",
>>>>> new
>>>>> Integer(200));
>>>>>
>>>>>                 // Insert a paragraph break into the document (not the
>>>>> frame)
>>>>>                 xText.insertControlCharacter(xTextCursor,
>>>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>>>
>>>>>                 XPropertySet xCursorProps =
>>>>> (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
>>>>> xTextCursor);
>>>>>
>>>>>                 xCursorProps.setPropertyValue("BreakType",
>>>>> com.sun.star.style.BreakType.PAGE_AFTER);
>>>>>
>>>>>                 xText.insertControlCharacter(xTextCursor,
>>>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>>>                 
>>>>>             } catch (Exception e) { 
>>>>>                 System.out.println(e.getMessage());
>>>>>                 
>>>>>                 e.printStackTrace();
>>>>>             }
>>>>>         }
>>>>>     }
>>>>>
>>>>> Which doesn't seem to work either, see attached.
>>>>>
>>>>> Is there a problem specifying a "long" for the vertical position,
>>>>> rather
>>>>> than an "Integer", ie., the value when you get to page 3 or 4 is over
>>>>> 32768
>>>>> pixels high.
>>>>>
>>>>> Any thoughts, do I have to move the view cursor or something or
>>>>> somehow
>>>>> to
>>>>> get the anchor on to the next page.. I notice when I try it manually,
>>>>> i
>>>>> need
>>>>> to "cut" the text frame, move to the next page and paste the frame, I
>>>>> then
>>>>> notice that the anchor is moved to the right page.. 
>>>>>
>>>>> At present, it seems all of the textframes remain on page1 in top/left
>>>>> corner.
>>>>>
>>>>> I can happily move the textframes using the above technique around the
>>>>> first
>>>>> page, but not on to the next page....
>>>>>
>>>>> Your help is greatly appreciated.
>>>>>
>>>>> Chris
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Fernand Vanrie wrote:
>>>>>   
>>>>>       
>>>>>> Chris Fleischmann wrote:
>>>>>>     
>>>>>>         
>>>>>>> I have gotten so far as;
>>>>>>>
>>>>>>> private void moveTextFrames() {
>>>>>>>         XTextFramesSupplier xTextFramesSupplier =
>>>>>>> (XTextFramesSupplier)
>>>>>>>                 UnoRuntime.queryInterface(XTextFramesSupplier.class,
>>>>>>> xWriterComponent_dest);
>>>>>>>
>>>>>>>         XNameAccess xNamedFrames =
>>>>>>> xTextFramesSupplier.getTextFrames();
>>>>>>>
>>>>>>>         XIndexAccess xIndexAccess = (XIndexAccess)
>>>>>>>                 UnoRuntime.queryInterface(
>>>>>>>                 XIndexAccess.class, xNamedFrames);
>>>>>>>
>>>>>>>         XText xText = xTextDocument_dest.getText();
>>>>>>>
>>>>>>>         XTextCursor xTextCursor = xText.createTextCursor();
>>>>>>>
>>>>>>>         for (int i = 0; i < xIndexAccess.getCount(); i++) {
>>>>>>>             try {
>>>>>>>                 Any xImageAny = (Any) xIndexAccess.getByIndex(i); 
>>>>>>>                 Object textFrame = xImageAny.getObject();
>>>>>>>
>>>>>>>                 XTextContent xFrameContent =
>>>>>>> (XTextContent)textFrame;
>>>>>>>
>>>>>>>                 XPropertySet xShapeProps = (XPropertySet)
>>>>>>> UnoRuntime.queryInterface(XPropertySet.class, textFrame);
>>>>>>>
>>>>>>>                 xShapeProps.setPropertyValue("AnchorType",
>>>>>>> TextContentAnchorType.AT_PAGE);
>>>>>>>
>>>>>>>                 // Setting the vertical and horizontal position
>>>>>>>                 int height = (i * page_size.Height) + 1000;
>>>>>>>
>>>>>>>                 xShapeProps.setPropertyValue("VertOrient", new
>>>>>>> Short(VertOrientation.NONE));
>>>>>>>                 xShapeProps.setPropertyValue("HoriOrient", new
>>>>>>> Short(HoriOrientation.NONE));
>>>>>>>                 xShapeProps.setPropertyValue("HoriOrientPosition",
>>>>>>> new
>>>>>>> Integer(1000));
>>>>>>>                 xShapeProps.setPropertyValue("VertOrientPosition",
>>>>>>> new
>>>>>>> Integer(height));
>>>>>>>
>>>>>>>                 // Set the width and height of the shape.
>>>>>>>                 xShapeProps.setPropertyValue("FrameWidthAbsolute",
>>>>>>> new
>>>>>>> Integer(frame_size.Width));
>>>>>>>                 xShapeProps.setPropertyValue("FrameHeightAbsolute",
>>>>>>> new
>>>>>>> Integer(frame_size.Height));
>>>>>>>                
>>>>>>> xShapeProps.setPropertyValue("FrameIsAutomaticHeight",
>>>>>>> new
>>>>>>> Boolean(false));
>>>>>>>                 xShapeProps.setPropertyValue("SizeType", new
>>>>>>> Short((short)1));
>>>>>>>
>>>>>>>                 xShapeProps.setPropertyValue("LeftBorderDistance",
>>>>>>> new
>>>>>>> Integer(200));
>>>>>>>                 xShapeProps.setPropertyValue("RightBorderDistance",
>>>>>>> new
>>>>>>> Integer(200));
>>>>>>>                 xShapeProps.setPropertyValue("TopBorderDistance",
>>>>>>> new
>>>>>>> Integer(200));
>>>>>>>                 xShapeProps.setPropertyValue("BottomBorderDistance",
>>>>>>> new
>>>>>>> Integer(200));
>>>>>>>
>>>>>>>                 // Insert a paragraph break into the document (not
>>>>>>> the
>>>>>>> frame)
>>>>>>>                 xText.insertControlCharacter (xTextCursor,
>>>>>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>>>>>
>>>>>>>                 XPropertySet xCursorProps =
>>>>>>> (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
>>>>>>> xTextCursor);
>>>>>>>
>>>>>>>                 xCursorProps.setPropertyValue("BreakType",
>>>>>>> com.sun.star.style.BreakType.PAGE_AFTER);
>>>>>>>
>>>>>>>                 xText.insertControlCharacter(xTextCursor,
>>>>>>> ControlCharacter.PARAGRAPH_BREAK, false);
>>>>>>>
>>>>>>>                 xTextCursor.gotoEnd(false);
>>>>>>>             } catch (Exception e) { 
>>>>>>>                 System.out.println(e.getMessage());
>>>>>>>                 
>>>>>>>                 e.printStackTrace();
>>>>>>>             }
>>>>>>>         }
>>>>>>>     }
>>>>>>>
>>>>>>>
>>>>>>> Which allows me to grab the existing textfram. I then attempt to
>>>>>>> change
>>>>>>> the
>>>>>>> verticial position based on the page size, and once moved add a new
>>>>>>> page
>>>>>>> to
>>>>>>> the document and updating the height value for the next frame's
>>>>>>> translation...
>>>>>>>
>>>>>>> This doesn't seem to work, ie., the textframe(s) do not move to the
>>>>>>> next
>>>>>>> page, they don't translate, the seem to move down the page by
>>>>>>> increments
>>>>>>> of
>>>>>>> 1000? Shouldn't the Anchor, AT_PAGE move to the "second", "third" or
>>>>>>> etc.
>>>>>>> etc. page, rather than stick to page 1?
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>> Chris,
>>>>>>
>>>>>> AT_PAGE is the only option, but the vertical position is calqulated
>>>>>> from 
>>>>>> the begining off the document, so for every Page you have to ad the 
>>>>>> hight off every page .
>>>>>> And i think a viewCursor gives  you information about the pagenr wher 
>>>>>> the frame is located.
>>>>>>
>>>>>> Hope it helps
>>>>>>
>>>>>> Fernand
>>>>>>     
>>>>>>         
>>>>>>> thanks for any help you may be able to shed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Chris Fleischmann wrote:
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>> Hello folks, I have TextFrames, that are created like so (at the
>>>>>>>> beginning
>>>>>>>> of the process):
>>>>>>>>
>>>>>>>> private XText getTextFrame(XText xText, int x, int y) {
>>>>>>>>         try {
>>>>>>>>             Object textFrame =
>>>>>>>> xWriterFactory.createInstance("com.sun.star.text.TextFrame");
>>>>>>>>
>>>>>>>>             XTextContent xTextContentFrame = (XTextContent)
>>>>>>>> UnoRuntime.queryInterface(XTextContent.class, textFrame);
>>>>>>>>
>>>>>>>>             XPropertySet xShapeProps = (XPropertySet)
>>>>>>>> UnoRuntime.queryInterface(XPropertySet.class, textFrame);
>>>>>>>>
>>>>>>>>             xShapeProps.setPropertyValue("AnchorType",
>>>>>>>> TextContentAnchorType.AT_PARAGRAPH);
>>>>>>>>
>>>>>>>>             // Setting the vertical and horizontal position
>>>>>>>>             xShapeProps.setPropertyValue("VertOrient", new
>>>>>>>> Short(VertOrientation.NONE));
>>>>>>>>             xShapeProps.setPropertyValue("HoriOrient", new
>>>>>>>> Short(HoriOrientation.NONE));
>>>>>>>>             xShapeProps.setPropertyValue("VertOrientPosition", new
>>>>>>>> Integer(x));
>>>>>>>>             xShapeProps.setPropertyValue("HoriOrientPosition", new
>>>>>>>> Integer(y));
>>>>>>>>
>>>>>>>>             // Set the width and height of the shape.
>>>>>>>>             xShapeProps.setPropertyValue("FrameWidthAbsolute", new
>>>>>>>> Integer(frame_size.Width));
>>>>>>>>             xShapeProps.setPropertyValue("FrameHeightAbsolute", new
>>>>>>>> Integer(frame_size.Height));
>>>>>>>>             xShapeProps.setPropertyValue("FrameIsAutomaticHeight",
>>>>>>>> new
>>>>>>>> Boolean(false));
>>>>>>>>             xShapeProps.setPropertyValue("SizeType", new
>>>>>>>> Short((short)1));
>>>>>>>>
>>>>>>>>             xShapeProps.setPropertyValue("LeftBorderDistance", new
>>>>>>>> Integer(200));
>>>>>>>>             xShapeProps.setPropertyValue("RightBorderDistance", new
>>>>>>>> Integer(200));
>>>>>>>>             xShapeProps.setPropertyValue("TopBorderDistance", new
>>>>>>>> Integer(200));
>>>>>>>>             xShapeProps.setPropertyValue("BottomBorderDistance",
>>>>>>>> new
>>>>>>>> Integer(200));
>>>>>>>>
>>>>>>>>             xText.insertTextContent(xText.getEnd(),
>>>>>>>> xTextContentFrame,
>>>>>>>> false);
>>>>>>>>
>>>>>>>>             XText xFrameText = (XText)
>>>>>>>> UnoRuntime.queryInterface(XText.class, textFrame);
>>>>>>>>
>>>>>>>>             return xFrameText;
>>>>>>>>         } catch (java.lang.Exception e) {
>>>>>>>>             e.printStackTrace();
>>>>>>>>         }
>>>>>>>>
>>>>>>>>         return null;
>>>>>>>>     }
>>>>>>>>
>>>>>>>> This method seems to work, it creates the textframe with a specific
>>>>>>>> size,
>>>>>>>> at a specific x/y location.
>>>>>>>>
>>>>>>>> I am now attempting to iterate over the "said" textframes like so:
>>>>>>>>
>>>>>>>> XTextFramesSupplier xTextFramesSupplier = (XTextFramesSupplier)
>>>>>>>>                
>>>>>>>> UnoRuntime.queryInterface(XTextFramesSupplier.class,
>>>>>>>> xWriterComponent_dest);
>>>>>>>>
>>>>>>>>         XNameAccess xNamedFrames =
>>>>>>>> xTextFramesSupplier.getTextFrames();
>>>>>>>>         
>>>>>>>>         String[] textframes = xNamedFrames.getElementNames();
>>>>>>>>
>>>>>>>>         for (int i = 0; i < textframes.length; i++) {
>>>>>>>>             XTextFrame textframe = null;
>>>>>>>>
>>>>>>>>             try {
>>>>>>>>                 textframe =
>>>>>>>> (XTextFrame)xNamedFrames.getByName(textframes[i]);
>>>>>>>>
>>>>>>>>                 XTextContent xFrameContent = (XTextContent)
>>>>>>>> UnoRuntime.queryInterface(XTextContent.class, textframe);
>>>>>>>>
>>>>>>>>                 XPropertySet xShapeProps = (XPropertySet)
>>>>>>>> UnoRuntime.queryInterface(XPropertySet.class, textframe);
>>>>>>>>
>>>>>>>> Which seems to work, ie., i can iterate over the above "said"
>>>>>>>> frames....
>>>>>>>> I
>>>>>>>> have tried doing:
>>>>>>>>
>>>>>>>> xShapeProps.setPropertyValue("AnchorType",
>>>>>>>> TextContentAnchorType.AT_PARAGRAPH);
>>>>>>>>
>>>>>>>>                 // Setting the vertical and horizontal position
>>>>>>>>                 xShapeProps.setPropertyValue("VertOrient", new
>>>>>>>> Short(VertOrientation.NONE));
>>>>>>>>                 xShapeProps.setPropertyValue("HoriOrient", new
>>>>>>>> Short(HoriOrientation.NONE));
>>>>>>>>                 xShapeProps.setPropertyValue("VertOrientPosition",
>>>>>>>> new
>>>>>>>> Integer(1000 + (i * 1000)));
>>>>>>>>                 xShapeProps.setPropertyValue("HoriOrientPosition",
>>>>>>>> new
>>>>>>>> Integer(1000));
>>>>>>>>
>>>>>>>> so as to move the frames slowly but sure down the page....
>>>>>>>>
>>>>>>>> That doesn't seem to work?
>>>>>>>>
>>>>>>>> Secondly, is there a way to create a new page between each cycle so
>>>>>>>> that
>>>>>>>> I
>>>>>>>> can move the textframe to the new page with the same, x/y origin?
>>>>>>>>
>>>>>>>> Thanks in advance for any help you can shed on the issue,
>>>>>>>>
>>>>>>>> Chris
>>>>>>>>                 
>>>>>>>>
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>   
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/I-have-five-text-frames-on-the-one-page%2C-can-I-move-each-frame-to-a-new-page--tp24146586p24177316.html
Sent from the openoffice - api dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to