diff --git a/PROMS/DataLoader/Sections.cs b/PROMS/DataLoader/Sections.cs index 279a6e2a..53b7db36 100644 --- a/PROMS/DataLoader/Sections.cs +++ b/PROMS/DataLoader/Sections.cs @@ -100,7 +100,10 @@ namespace DataLoader // acccontent int Documentid=0; bool needEntry = false; - if (libdocid != 0 || stpseq.Substring(1, 1) != "0") + if ((format.PlantFormat.DocStyles.DocStyleList[docstyleindx].StructureStyle.Style & E_DocStructStyle.TableOfContents) == E_DocStructStyle.TableOfContents && + (format.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoTableOfContents) == E_PurchaseOptions.AutoTableOfContents) + needEntry = false; + else if (libdocid != 0 || stpseq.Substring(1, 1) != "0") { needEntry = true; string fname = null; @@ -367,7 +370,7 @@ namespace DataLoader set { Loader._OverrideColor = value; } } - private Item MigrateSection(Item procitem, string procnum, OleDbConnection cn, DataRowView dr, DataTable dt, Item FromItem, bool isSubSection, string pth, DocVersion docver, FormatInfo activeFormat,Content cont) + private Item MigrateSection(Item procitem, string procnum, OleDbConnection cn, DataRowView dr, DataTable dt, Item FromItem, bool hasSubSection, string pth, DocVersion docver, FormatInfo activeFormat,Content cont) { Int32 thesectid = 0; bool isautogen = false; @@ -426,10 +429,9 @@ namespace DataLoader // |`------------ Step Section Header marker // `------------- Internal section number (starts at A) char cbittst = sequence.PadRight(10)[8]; + if (cbittst == ' ') cbittst = '\0'; if (step.Substring(1, 1) == "0") { - // if this section has the original edit section flag (sequence[2]) save the id. - // set pagination, continuous, separate. If blank, don't create attribute - uses format default. if (sequence.Substring(2, 1) != " ") { @@ -449,55 +451,41 @@ namespace DataLoader { ci.AddItem("Step", "LnkEnh", "Y"); } - if (cbittst == ' ') - cbittst = '\0'; - else + // determine if autogenerated section (!exist = N) + if ((cbittst & AUTOGEN) > 1) { - // determine if autogenerated section (!exist = N) - if ((cbittst & AUTOGEN) > 1) - { - isautogen = true; - ci.AddItem("Section", "AutoGen", "Y"); - } + isautogen = true; + ci.AddItem("Section", "AutoGen", "Y"); } // Here are subsection flags, i.e. the following are only set if this // is a subsection. bool didsub = false; - if (isSubSection) + if (hasSubSection) { - // Subsection: editable (!exist = Y) + // Subsection: editable (!exist = N, i.e. default is 'not editable') if ((cbittst & EDDATA) > 0) { - ci.AddItem("SubSection", "Edit", "N"); + ci.AddItem("SubSection", "Edit", "Y"); } - - // Subsection: print section headers (!exist = Y) - if ((cbittst & PH) > 0) - { - didsub = true; - ci.AddItem("SubSection", "PH", "N"); - } - - // Subsection: autoindent (!exist = Y) + // Subsection: autoindent (!exist = Y, i.e. default is 'autoindented') if ((cbittst & AUTOIND) > 0) { ci.AddItem("SubSection", "AutoIndent", "N"); } } - if (cbittst == ' ') - cbittst = '\0'; - else + // Section: print section headers (!exist = Y, i.e. default is 'print section header') + // Note that this can be on a section or subsection. 16bit code has this for both + // levels and it was stored either as a bit set on seq[8] (for subsections, i.e. + // this subsection does not have subsections under it) or was a character in seq[9] (Y or N), + // i.e. this section has subsections. Make this just one flag now. + if (hasSubSection && ((cbittst & PH) == 0)) { - // Both step & word doc sections can be in toc - // determine if TOC element (!exist = N) - if ((cbittst & TOC) > 1) - { - ci.AddItem("Section", "TOC", "Y"); - } + didsub = true; + ci.AddItem("Section", "PrintHdr", "N"); } - if (!didsub && sequence.Substring(4, 1) == "N") + if (!hasSubSection && sequence.Substring(9, 1) == "N") { - ci.AddItem("SubSection", "PH", "N"); + ci.AddItem("Section", "PrintHdr", "N"); } // Save section level Checkoff information int chkOffType = (rid[0] & 0x007F) - '0'; @@ -533,6 +521,12 @@ namespace DataLoader libDocid = dicLibDocRef[thekey]; } } + // Both step & word doc sections can be in toc + // determine if TOC element (!exist = N) + if ((cbittst & TOC) > 1) + { + ci.AddItem("Section", "TOC", "Y"); + } //Console.WriteLine("Before AddSection"); Item secitem = AddSection(procitem, num, title, stype, dts, init, ci, step + sequence, fmt, libDocid, pth, FromItem, sectFormat); //Console.WriteLine("After AddSection");