Skip to main content
Gene Sorg
Participant
July 17, 2019
Answered

Newbie question for creating new FM document and table.

  • July 17, 2019
  • 1 reply
  • 598 views

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 has been closed for replies.
Correct answer frameexpert

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.

1 reply

frameexpert
Community Expert
Community Expert
July 17, 2019

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

www.frameexpert.com
Gene Sorg
Gene SorgAuthor
Participant
July 17, 2019

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

frameexpert
Community Expert
Community Expert
July 17, 2019

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.

www.frameexpert.com