You basically have to loop through the table and write out the content to paragraphs the way you want them and then delete the table. I haven't found a way to access the actual Table > Convert to Paragraphs command.
Do you have a code example to help get me started, to show how I would write out the content of the paragraphs?
I also thought I could use the Copy and Paste commands. I set the text range to the beginning paragraph and ending paragraph of a cell, then copy.
Then I set a new text range in the document where I want the text to go and paste.
But how do I then get the paragraph object(s) for each of those newly pasted paragraphs?
When you have copied the text range from the table cell, go to where you want to paste the materials, then insert a new paragraph, set the text location to the start of that new paragraph and paste. From the new paragraph, you should be able to find all new paragraphs as they are linked through their NextPgf properties. For each of the pasted paragraphs, apply the correct paragraph format (as it will probably be a table cell format and you will want to use some kind of body format instead.
The following code should do exactly what you want:
FCodesList = new Array(FCodes.KBD_TABLE_CONVERT, FCodes.START_DIALOG, FCodes.KBD_RETURN, FCodes.END_DIALOG ); // Build List of FCodes
FCodes(FcodesList); //Execute FCodes
The trick is to use FCodes.START_DIALOG and FCodes.END_DIALOG codes, because otherwise the confirmation of the Convert to Paragraph dialog with Enter (KBD_RETURN) does not work.
As far as I can see, the FCodes for dialog boxes don't work with Windows FrameMaker. If you look at the FDK Programmer's Guide, around page 270, there is a section called "Simulating user input". It says,
IMPORTANT: F_ApiFcodes() does not work with dialog boxes on Windows.
I just tried it and the same is true with the ExtendScript Fcodes method.
shows that FCode sequences work in dialogs too, it's just that the code for the tab key is, totally counterintuitively, FCodes.KBD_ItemNextLogical instead of FCodes.KBD_TAB, which one might have guessed.
Is there anyway I can accomplish the opposite using Fcodes? I want to convert selected paragraphs to a table. If this is not possible, Is there a command to simply open the "Convert to Table" dialog box in FrameMaker?
1 person found this helpful