Skip to main content
Gene Sorg
Participant
Jul 17, 2019 6:52 PM UTC
Answered

Newbie question for creating new FM document and table.

I have written a little jsx to extract data (mostly formats) from an existing Framemaker document and stored that data into multiple lists but am having all kinds of issues creating new data. How do I create a new document and table, load the list data into the table, and save out that table in a stand alone file. Nothing I tried from documentation and the net works like app.documents.add();. This language is just not clicking with me yet. Thanks in advance.

Example Only:

var hero = ['Superman', 'Spiderman', 'Wonder Woman'];

var fName = ['Clark', 'Peter', 'Diana'];

var lName = ['Kent', 'Parker', 'Prince'];

create a new document                     // var myDocument = app.documents.add(); does not work

create a table in the new document  // new Table NewVar(tblVar) Format ("Format A") NumCols(3) HeaderRows(1) BodyRows(10) FooterRows(0);

add data so it looks like:

save document as .fm file

This topic is closed to new replies. Start a new post to keep the conversation going.
frameexpert
frameexpertCorrect answer
Community Expert
Jul 17, 2019 8:42 PM UTC

No problem and thanks. I have already done as you suggested. One more thing, how do I "close" this thread?


I am not sure, but I will add links to the other ones:

Newbie Question #1: Creating New Document

Newbie Question #2: Creating Tables

Newbie Question #3: Modifying Table Data

I have already submitted answers to the other threads.

www.frameexpert.com

5 replies

frameexpert
Community Expert
Community Expert
Jul 17, 2019 7:11 PM UTC

Hi Gene,

I would suggest that you break this question into tasks and post a question for each one:

1) How do I create a new document? Do you want a blank, portrait document, or do you want to create a document based on a template.

2) How do I add a table to a document?

3) How do I navigate a table and add data to it?

It's usually easier to get answers this way. Thanks.

Rick

Translate
www.frameexpert.com
Gene Sorg
Gene SorgAuthor
Participant
Jul 17, 2019 7:20 PM UTC

I did not think they were that complicated of questions and could be answered in a couple lines of code each.

Translate
frameexpert
Community Expert
Community Expert
Jul 17, 2019 8:00 PM UTC

Everything is more complicated than you think :-). Plus, if you limit each question to a specific task, you help others that may need to do just one of the tasks.

Translate
www.frameexpert.com