Engineering Requirements Management

 View Only
  • 1.  How do I add a static title page to a document?

    Posted Mon June 21, 2021 05:34 PM

    Hello,

    I am creating a report that gives the differences in the modules that we have added/modified since the previous baseline. I have been successful at creating the main portion of the Word document, but I want to go to the start of the document, add a certain title with a different size and color of text and center that text, then move the rest of the text of the document to another page. Is there a way to move the cursor back to the beginning of a document then center the first line of text before adding a new page break? And how do I change the alignment and font of the title text in DXL?

    Chris





    #SupportMigration
    #EngineeringRequirementsManagement
    #Support
    #DOORS
    #Sustainability


  • 2.  RE: How do I add a static title page to a document?

    Posted Tue June 22, 2021 12:39 PM

    DB load = centered "" DBE x = field (load, "", "Test", 10, false)x->"top"->"form"x->"right"->"form"x->"left"->"unattached" DBE xl = label(load, "Test:")xl->"right"->"flush"->xxl->"top"->"form"xl->"left"->"unattached" DBE y = field (load, "", "Test", 10, false)y->"right"->"form"y->"top"->"spaced"->xy->"left"->"unattached" DBE yl = label(load, "A longer label:")yl->"right"->"flush"->yyl->"top"->"spaced"->xyl->"left"->"unattached" realize load setSize (load, 400, 200) show load

    and to place a elements inside of frame--

    "constrained placement" works by attaching stuff together. In the code you see that the fields are attached to the form on the right side, while the labels are attached to the fields on the right side.

    // fieldsfield->"right"->"form"field->"left"->"unattatched"// ...// labels// ...label->"right"->"spaced"->fieldlabel->"left"->"unattached"If you want to put them inside a frame you would replace "right"->"form" by "right"->"inside"->tab and top->"spaced"->"form" by top->"inside"->tab.If you need your frame/tab to resize to your elements size you would have to attach the largest label to the left side of the frame. An easier way is to give the frame/tab a fixed size and leave the left side unattached (as I did in the example).

    or

    read the DXL Help >> Dialog boxes >> Simple placement section.





    #EngineeringRequirementsManagement
    #Sustainability
    #SupportMigration
    #DOORS
    #Support


  • 3.  RE: How do I add a static title page to a document?

    Posted Tue June 22, 2021 12:50 PM

    First, I don't want the user to have to select anything from a dialog box. It needs to be automatic. Second, I'm not sure how to go to the beginning of the document after creating the doc and/or add a new page after creating the title page first.





    #Support
    #SupportMigration
    #EngineeringRequirementsManagement
    #Sustainability
    #DOORS


  • 4.  RE: How do I add a static title page to a document?

    Posted Tue June 22, 2021 01:21 PM

    Here is the function I'm currently using that simply takes an HTML file and saves it as a .doc. I just need to either create the title page before adding the HTML or use the HTML to create the doc and go to the beginning of the document and add a new page with the text I want to include.

    void createWordDoc() {

    OleAutoObj objWord;

    OleAutoObj objDocs, objDoc;

    OleAutoArgs autoArgs = create;

    OleAutoArgs macroArgs = create;

    string nameOfMacro = "printHTMLtoDOC";

    string sHTMLFileName;

    string s_fileName;

    sHTMLFileName = CMG_USER_DESKTOP "\\DLDUpdates.html";

    s_fileName = sFileNameDOC;

    string sErrorMess = copyFile(CMG_VBA_FORMATTER_DIR sFormatterFileName, s_fileName);

    if(!null sErrorMess) infoBox "Couldn't copy formatter file"

    if(!canOpenFile(s_fileName, false)) {

    infoBox "CSV formatter not configured or cannot be accessed. \n Data HTML is in a file on your desktop."

    return;

    }

    objWord = oleCreateAutoObject("Word.Application");

    if(null objWord)

    errorBox("Unable to open word application");

    olePut(objWord, "Visible", true);

    oleGet(objWord, "Documents", objDocs);

    put(autoArgs, sHTMLFileName);

    oleMethod(objDocs, "Open", autoArgs, objDoc);

    put(macroArgs, nameOfMacro);

    put(macroArgs, sHTMLFileName);

    put(macroArgs, sFileNameDOC);

    oleMethod(objWord, "Run", macroArgs);

    infoBox("Document saved.");

    }





    #Sustainability
    #Support
    #DOORS
    #SupportMigration
    #EngineeringRequirementsManagement