• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to add a table after the first paragraph

Community Beginner ,
Jul 25, 2019 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

334

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jul 25, 2019 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);

Votes

Translate

Translate
Community Expert ,
Jul 25, 2019 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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 25, 2019 Jul 25, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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