Copy link to clipboard
Copied
Hi.
I am facing the following problem:
Suppose that I have the following paragraphs in FrameMaker:
This is a sentence. And (simple line end)
also there this sentence. (paragraph end)
This is a sentence. And (hard return)
also there this sentence. (paragraph end)
This is a sentence. And (simple line end)
also there this sentence. (hard return)
But there is also this sentence (paragraph end)
This is a sentence. And (simple line end)
also there this sentence. (hard return)
also there this sentence. (hard return)
But there is also this sentence (paragraph end)
What I want is the following:
Get the whole paragraph text where the insertion point of the cursor is.
However, when hard line ends exist I want to change behavior.
Here is the behavior for the above paragraphs:
For the first paragraph example if the cursor is either in first or in second line I want to get the whole paragraph.
For the second paragraph if the cursor is in the first line I want only the first line. And if it is in the second line I want only the second line.
For the third paragraph if the cursor either in first or second line I want both first and second lines to be retrieved as single text. Also if the cursor is in the third line I want only the third line.
For the fourth paragraph it works like the third paragraph. And if the cursor is in the third line I get only this one.
Could you please provide some code with FDK in C++ to start with?
It is a brain teaser.
As you are in the Scripting forum, I am relating to that here. You will have to figure out the C++ code from the FDK yourself.
There is not a lot to tease my brain with this. You get the paragraph where the cursor is and retrieve the text plus line ends via the GetText() method, using a bit field that includes both FTI_String and FTI_LineEnd. Each line end has a modifier that tells you whether it is a hard or a soft return. You also get the offset in the paragraph of the current cursor position a
...Copy link to clipboard
Copied
As you are in the Scripting forum, I am relating to that here. You will have to figure out the C++ code from the FDK yourself.
There is not a lot to tease my brain with this. You get the paragraph where the cursor is and retrieve the text plus line ends via the GetText() method, using a bit field that includes both FTI_String and FTI_LineEnd. Each line end has a modifier that tells you whether it is a hard or a soft return. You also get the offset in the paragraph of the current cursor position and then create the required strings from the array of text items returned by the GetText method.
If you want full running code, ask someone to program it for you and be prepared to pay for the work.
Good luck
Copy link to clipboard
Copied
Thanks people, I have done it.
Copy link to clipboard
Copied
Problem solved. Thanks.