TDF / Tech Docs: DocumentSchemaElement for Section from Content Generator?

I've already looked at this Labs project:  GitHub - ArasLabs/content-generator-samples: This project contains code snippets to demonstrate how to create and manipulate content in Aras Technical Documents. and also in the documentation, but can't see the proper commands for Section or Chapter.

Basically I'm looking for the proper content generator code to:

- Create a section or chapter with the title pre-filled out (such as "Introduction")

- Create a sub-section or sub-chapter below the above (after the pre-filled out content).

This:

DocumentSchemaElement sectionElement = (DocumentSchemaElement) this.Factory.NewElement("Section") ;

sectionElement.AddChild(this.Factory.NewText("Title","Introduction"));

targetElement.AddChild(sectionElement);

Sort of works.  It creates a section, but it doesn't fill out the Title of the section, it fills it as a child.

Does anyone have any guidance on this?  Thanks in advance!!

Parents
  • I haven´t used TechDocs since 2 years, so I will try :).

    Have you checked the Document Types so it matches the structure you want to build? If you use the standard schema, you may have to add the parent title first. Have you checked your minOccurs/maxOccurs settings?

    In my case I remember that I kicked out the "chapter" used by Aras cause it just confused the end users. Aras uses Chapter in parallel to Section so users never new what to use. In additional you have to maintain double structures when you want to have multiple sub-sections.

Reply
  • I haven´t used TechDocs since 2 years, so I will try :).

    Have you checked the Document Types so it matches the structure you want to build? If you use the standard schema, you may have to add the parent title first. Have you checked your minOccurs/maxOccurs settings?

    In my case I remember that I kicked out the "chapter" used by Aras cause it just confused the end users. Aras uses Chapter in parallel to Section so users never new what to use. In additional you have to maintain double structures when you want to have multiple sub-sections.

Children
  • 0 オフライン in reply to AngelaIp

    Hey Angela,

    Yes Document type matches and the standard schema is what we're using as a test area.  The auto-application/calling of the Content Generator isn't the issue, I was looking for guidance on the DocumentSchemaElement call as there isn't any examples of a Section or Chapter in the documentation.

    For instance, two items in the above content generator code example I gave:

    this.Factory.NewText("Title","Introduction")

    this.Factory.NewElement("Section")

     

    The Factory call for NewText takes the Schema element (Title) and a value for it (Introduction).  The Factory call for a "NewElement" that a Section falls under doesn't accept any "value".  I can't find any documentation on the Factory calls.

    Does that make sense?

    Thanks in advance!

  • In which XML Schema Element to you use your code?

    You can use an Content Generator for "Section" that add the default title as soon as you add a section.

    E.g. I used this one for a similar "TOC section" to automatically add an "Title" and a "TOC":

    targetElement.AddChild(this.Factory.NewText("Title", "Table Of Contents"));
    targetElement.AddChild(this.Factory.NewElement("TOC"));

    But I really would suggest you to ask Aras support :).