Skip to main content
Known Participant
October 10, 2012
Question

Convert Table to Text

  • October 10, 2012
  • 2 replies
  • 2046 views

I cannot find a method in the framemaker scripting guide for the Table > Convert to Paragraphs command.

I found a suspicious Fcode command: FCodes.KBD_TABLE_CONVERT. Not so great. I  neither like Fcodes, nor do think this would do what I want.

Advice?

Thanks,

Jason

This topic has been closed for replies.

2 replies

Participating Frequently
October 30, 2015

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.

frameexpert
Community Expert
Community Expert
October 30, 2015

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.

Participating Frequently
October 31, 2015

ExtendScript of the Week: Keyboard Simulation in FrameMaker via Fcodes – TechComm Central by Adobe

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.

frameexpert
Community Expert
Community Expert
October 10, 2012

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.

Rick

Participant
October 16, 2012

Rick,

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?

Thanks,

Jason

4everJang
Legend
October 19, 2012

Jason,

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.

Good luck

Jang