How to add a table after the first paragraph

Community Beginner ,
Jul 25, 2019

Copy link to clipboard

Copied

I want to add multiple lines of text (each ending with \n) to the first paragraph in a document and then add a table after that. I can create the doc and table but there is only 1 line in the paragraph and the rest of the lines are there but covered up by the table.

     doc = app.ActiveDoc;

     var textLoc, tbl;

     textLoc = new TextLoc (doc,MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, 0);

     doc.AddText (textLoc, multipleLineStringVariable );

     //This works but only shows 1 line in the paragraph which makes sense

     //textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, 0);

     //My first attempt at using a Constant and this line crashed FrameMaker

     textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, Constants.FV_OBJ_END_OFFSET);

     // NewTable(format, numCols, numBodyRows, numHeaderRows, numFooterRows, textLoc);

     tbl = doc.NewTable ("Format A", 4, 10, 1, 0, textLoc);

TOPICS
Scripting

Views

158

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Jul 25, 2019
frameexpert Adobe Community Professional , Jul 25, 2019
Instead of this:     textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, Constants.FV_OBJ_END_OFFSET);use this:     textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, Constants.FV_OBJ_END_OFFSET - 1);

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

Instead of this:

     textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, Constants.FV_OBJ_END_OFFSET);

use this:

     textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, Constants.FV_OBJ_END_OFFSET - 1);

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Gene_Sorg AUTHOR LATEST
Community Beginner ,
Jul 25, 2019

Copy link to clipboard

Copied

Thanks. I also had to remove the "\n" at the end of each line as I stated "multiple lines of text (each ending with \n)". I guess a paragraph only had 1 "\n" by definition. I guess I will have to do a list instead. I am trying to list book and doc processed in the paragraph (one per line):

Book: C:\blah-blah\ES_Samples\SampleBook.book

Doc: C:\blah-blah\ES_Samples\SampleBookTOC.fm

Doc: C:\blah-blah\ES_Samples\SampleFile_UNSTRUCTURED.fm

Doc: C:\blah-blah\ES_Samples\SampleFile_UNSTRUCTURED_2.fm

Doc: C:\blah-blah\ES_Samples\SampleFile_UNSTRUCTURED_3.fm

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more