Skip to main content
Participating Frequently
July 7, 2015
Answered

pgfFmt.Start property not working

  • July 7, 2015
  • 2 replies
  • 372 views

Hello guys:

I´ve tried this using FM 10 and FM 11 (unstructured), and it fails in both versions. The PgfFmt "Body" is shown as modified in FM (asterisk) but the Paragraph Designer shows the old Start property.

I need to update the "Start" PgfFmt property. I am using a shared code that works with the rest of PgfFmt properties.

source: (http://extendingframemaker.blogspot.com/2011/10/updating-paragraph-format.html)

var doc = app.ActiveDoc;

var tframe = doc.MainFlowInDoc.FirstTextFrameInFlow;

var pgfFmt = doc.GetNamedObject(Constants.FO_PgfFmt, "Body");

if (pgfFmt.ObjectValid) {

    pgfFmt.Start= Constants.FV_PGF_ANYWHERE;

    var formatFlags = Constants.FF_UFF_PGF | Constants.FF_UFF_REMOVE_EXCEPTIONS;

    doc.SimpleImportFormats (doc, formatFlags);

}

The document is already saved in my HD, so it exists. What is wrong?

Thanks!

This topic has been closed for replies.
Correct answer Russ Ward

Hi SFRIP,

I was able to confirm this behavior. It seems like a bug to me. Other paragraph properties apply correctly but this one does not. The only way I could get the Start property to apply was to iterate over all paragraphs and reapply the whole format:

pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

while(pgf.ObjectValid())

{

    if(pgf.Name == "Body")

    {

        pgf.SetProps(pgfFmt.GetProps());

    }

    pgf = pgf.NextPgfInFlow;

}

Hope that sample comes through OK. Incredibly, this forum editor continues to get harder to use.

Russ

2 replies

Russ WardCorrect answer
Legend
July 9, 2015

Hi SFRIP,

I was able to confirm this behavior. It seems like a bug to me. Other paragraph properties apply correctly but this one does not. The only way I could get the Start property to apply was to iterate over all paragraphs and reapply the whole format:

pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

while(pgf.ObjectValid())

{

    if(pgf.Name == "Body")

    {

        pgf.SetProps(pgfFmt.GetProps());

    }

    pgf = pgf.NextPgfInFlow;

}

Hope that sample comes through OK. Incredibly, this forum editor continues to get harder to use.

Russ

SFRIPAuthor
Participating Frequently
July 11, 2015

Thanks Russ, it works!!!

And yes, the forum sometimes is hard to use.

Regards and again thanks a lot!