Thread View: adobe.framemaker.sgml
6 messages
6 total messages
Started by Stanislav_Kurik
Tue, 05 Aug 2008 15:00
Problem with F_ApiAddText() after F_ApiPaste()
Author: Stanislav_Kurik
Date: Tue, 05 Aug 2008 15:00
Date: Tue, 05 Aug 2008 15:00
34 lines
1614 bytes
1614 bytes
Hello, I've some troubles adding text to structured document after I paste some text from clipboard into it. Here it is how it goes in the code: ... F_ApiSetTextRange(FV_SessionId, m_docId, FP_TextSelection, &tr); F_ApiPaste(m_docId, 0); F_ApiPopClipboard(); ... F_TextLoc addLoc; addLoc.objId = m_paragraphId; addLoc.offset = tr.beg.offset + pastedObjectLen; F_ApiAddText(m_docId, &addLoc, newText); The object from clipboard (in fact it's cross-reference) is pasted correctly to the right position but no text is added from then on. pastedObjectLen is length of the cross-reference text (including the element begin/end tags) I tried more variations of the line: addLoc.offset = tr.beg.offset + 1; addLoc.offset = tr.beg.offset + 2; ... But nothing works. Can somebody see where the problem lies? I'm using FrameMaker8. Thank you!
Re: Problem with F_ApiAddText() after F_ApiPaste()
Author: Stanislav_Kurik
Date: Wed, 06 Aug 2008 06:33
Date: Wed, 06 Aug 2008 06:33
5 lines
1271 bytes
1271 bytes
Now I discovered something. I checked the return value of F_ApiAddText() and FA_errno after the call and I found out that F_ApiAddText() returns F_TextLoc with { objId = 0, offset = 0 }, so invalid text location. FA_errno has the value FE_BadObjId.
So I investigated further and before the F_ApiAddText() call I traverse all paragraphs in the document and the paragraph to which I pasted the cross-reference is suddenly not there! Or to say it precisely, there is no paragraph with m_paragraphId anymore in the list of document's paragraphs.
How is that possible?
Re: Problem with F_ApiAddText() after F_ApiPaste()
Author: Rick_Quatro
Date: Wed, 06 Aug 2008 12:41
Date: Wed, 06 Aug 2008 12:41
5 lines
752 bytes
752 bytes
Stanislav, What is the exact task you are trying to perform? Someone may be able to give you an alternative solution. Rick Quatro
Re: Problem with F_ApiAddText() after F_ApiPaste()
Author: Stanislav_Kurik
Date: Thu, 07 Aug 2008 08:33
Date: Thu, 07 Aug 2008 08:33
7 lines
1512 bytes
1512 bytes
Hi Rick, thank you for response. What I was trying to do is copy&pasting cross-reference from one place to another and then adding some text behind it. Eventually, I found the solution. As I had already written, the paragraph ID is changed after the cross-reference is pasted into it. What I tried first was to save paragraph's UID and then obtain its new ID by calling F_ApiGetUniqueObject() but it didn't work (this function returned 0). Simple solution is to call F_ApiGetTextRange(FV_Session, docId, FP_TextSelection) after pasting the cross-reference and extract paragraph ID from the returned F_TextRangeT structure.
Re: Problem with F_ApiAddText() after F_ApiPaste()
Author: Russ Ward
Date: Thu, 07 Aug 2008 14:33
Date: Thu, 07 Aug 2008 14:33
5 lines
1172 bytes
1172 bytes
Hi Stanislav, I'm happy that you got it working, but just for future reference, I don't believe that a paragraph ID should change just because you pasted an xref into it. At least, assuming you are talking about its F_ObjHandleT ID. If you thought that you saw an object handle change, you might take a closer look at it next time... could just have been a bug somewhere in your code. Russ
Re: Problem with F_ApiAddText() after F_ApiPaste()
Author: Stanislav_Kurik
Date: Mon, 11 Aug 2008 10:42
Date: Mon, 11 Aug 2008 10:42
5 lines
1282 bytes
1282 bytes
Hi Russ, I also thought there is no reason for paragraph's ID to change after pasting xref into it. But it's really the case. When I tried to call eg. F_ApiAddText() after pasting the xref with the original ID, it failed. I think the proof is the solution I found: new paragraph ID obtained from F_TextRangeT tr = F_ApiGetTextRange(..., FP_TextSelection) is different from the original one. One more note: I think that paragraph ID changed only if the xref pasted was unresolved, ie. if it pointed to some unavailable location.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads