Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
9 replies Latest Post - ‏2012-04-24T21:11:04Z by SystemAdmin
Huyi.Wang
Huyi.Wang
6 Posts
ACCEPTED ANSWER

Pinned topic Is there a way to display a table?

‏2012-04-10T09:43:54Z |
I want to have 2 columns in a module:
1 Column: Object Heading&Text, which may contain tables as well as object headings, texts
2 Column: DXL, which shall display contents of the first column if current object hasn't out links. Otherwise, it shall displays the a column of the links.

I created such a script which have most of the functions above, but have 2 problems:
1. Can't display a table
2. Can't change Object Heading's font and font size, it can only be bolded

I have no ideas now to fix them. It'll be very appreciated if any suggestions.
Updated on 2012-04-24T21:11:04Z at 2012-04-24T21:11:04Z by SystemAdmin
  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: Is there a way to display a table?

    ‏2012-04-10T15:15:36Z  in response to Huyi.Wang
    If when you say "Table" you mean a DOORS Table, then it has no columns and you can display only one attribute in it (usually Object Text). Seems like you should adjust the properties of the table to display your Attr-DXL.

    If when you say "Table" you mean an OLE diagram of perhaps an MS-Word table, then you should be able to retrieve the Object Text:
    • string TextRich = richTextWithOle(obj, "Object Text")
    and when you are done set the attr DXL:
    • obj.attrDXLName = richText(Results)

    Perhaps someone else can help with the font size issue.

    -Louie
    • Huyi.Wang
      Huyi.Wang
      6 Posts
      ACCEPTED ANSWER

      Re: Is there a way to display a table?

      ‏2012-04-11T06:01:00Z  in response to llandale
      Thanks, I might know how to display my table now.
      Another question, in DOORS, when shall we have to use DOORS table? I feel in most any cases we can use word or other OLE tables.
      • llandale
        llandale
        2943 Posts
        ACCEPTED ANSWER

        Re: Is there a way to display a table?

        ‏2012-04-11T17:34:16Z  in response to Huyi.Wang
        There are other folks who like the native DOORS tables but some of us do not. If they contain "requirements" and you figure to "link" them with other documents, then they become hopeless.

        The OLE word-table approach is pretty standard, but lacks modification traceability. These you create in Word, copy, then insert a Word Object, and paste them there. Then copy the word object and paste into DOORS.

        For small tables I often use (what I call) "RTF" tables. Copy the Word table and directly paste it into DOORS (without the word-object step). You get rudametary formatting but the text is searchable and replaceable. If you need to modify the structure (more rows or wider cells), you need to copy to work, adjust, and copy back.

        -Louie
        • Huyi.Wang
          Huyi.Wang
          6 Posts
          ACCEPTED ANSWER

          Re: Is there a way to display a table?

          ‏2012-04-20T13:13:58Z  in response to llandale
          Thanks.
        • Peter_Albert
          Peter_Albert
          250 Posts
          ACCEPTED ANSWER

          Re: Is there a way to display a table?

          ‏2012-04-24T15:34:45Z  in response to llandale
          Picking up on that old post - how do you export those "RTF" tables back to Word? I tried, and in WEXP I only get the plain text exported - no table formatting.

          Regards,

          Peter
          • SystemAdmin
            SystemAdmin
            3180 Posts
            ACCEPTED ANSWER

            Re: Is there a way to display a table?

            ‏2012-04-24T17:11:18Z  in response to Peter_Albert

            None of the export methods are perfect.

            I think the one that does the best job overall is export as HTML. In particular, it does a good job with tables and pictures. I use the Table mode as opposed to the Book mode.

            After you export as HTML, you can open with Word and save as .DOC or .RTF file.

            Suppose you are exporting a subset for a meeting and using landscape format. You would export from a landscape-sized DOORS view. Next you could open in Firefox and set Firefox page properties to landscape. Select shrink to fit for extra assurance. Lastly print.

            VERY IMPORTANT -- Arrange the widths of columns just as you want them to appear once exported.

            I have a canned "Export Portrait View" and "Export Landscape View" for this purpose. OLE objects will be converted to PNG files and the resolution of those files is based on the width of columns upon export.

            You can use DXL to fine tune your column widths for an export view to save a lot of trial and error (and wasted trees).

            In this example:

            • Landscape is desired
            • Paper is 8.5 x 11"
            • Left and right margins are 0.75"
            • Columns (in order) are:
              • DOORS ID
              • (main column)
              • Object Type
              • Effectivity


            Everything is specified in inches and (main column) gets whatever is left over.

             

             

            // NOTE 96 pixels per inch is typical.  
            // It may vary with output device.
             
            void setColumnWidth() {
             
                real widthInInches_page = 11.0;
                real widthInInches_leftMargin = 0.75;
                real widthInInches_rightMargin = 0.75;
                real widthInInches_ID = 0.5;
                real widthInInches_ObjectType = 0.8;
                real widthInInches_Effectivity = 1.4;
             
                real widthInInches_main = widthInInches_page        //-
                                        - widthInInches_leftMargin  //-
                                        - widthInInches_rightMargin //-
                                        - widthInInches_ID          //-
                                        - widthInInches_ObjectType  //-
                                        - widthInInches_Effectivity;
             
                int widthInPixels_ID = intOf( (96.0 * widthInInches_ID) );
                print("Setting ID to " (widthInPixels_ID) " pixels.\n");
                width(column(0), widthInPixels_ID);
             
                int widthInPixels_main = intOf( (96.0 * widthInInches_main) );
                print("Setting Main to " (widthInPixels_main) " pixels.\n");
                width(column(1), widthInPixels_main);
             
                int widthInPixels_ObjectType = intOf( (96.0 * widthInInches_ObjectType) );
                print("Setting Object Type to " (widthInPixels_ObjectType) " pixels.\n");
                width(column(2), widthInPixels_ObjectType);
             
                int widthInPixels_Effectivity = intOf( (96.0 * widthInInches_Effectivity) );
                print("Setting Effectivity to " (widthInPixels_Effectivity) " pixels.\n");
                width(column(3), widthInPixels_Effectivity);
             
                int totalWidth = widthInPixels_ID + widthInPixels_main //-
                               + widthInPixels_ObjectType + widthInPixels_Effectivity;
             
                print("Total Width is " (totalWidth) " pixels\n");
                print("Total Width is " (widthInInches_page) " inches\n");
             
            }
             
            setColumnWidth();
            


            You can customize it for your particular

             

             

            Updated on 2014-01-09T15:10:14Z at 2014-01-09T15:10:14Z by JAntley
            • Peter_Albert
              Peter_Albert
              250 Posts
              ACCEPTED ANSWER

              Re: Is there a way to display a table?

              ‏2012-04-24T19:06:52Z  in response to SystemAdmin
              My apologies if my question was not properly put: I have no problem in general exporting DOORS views to HTML or Word - my specific question was on the "RTF" tables Louie had mentioned. They are in fact very useful to have small tables applear in the Object Text of an Object, but at least for me I fail to export them back to Word or HTML. To be clear, those are tables built in rich text, stored in the "Object text", using the fact that DOORS is able to display more RTF features than it is actually able to modify through the GUI.

              Regards,

              Peter
              • SystemAdmin
                SystemAdmin
                3180 Posts
                ACCEPTED ANSWER

                Re: Is there a way to display a table?

                ‏2012-04-24T21:11:04Z  in response to Peter_Albert
                I was thinking the HTML export honored RTF tables but I was wrong.

                I just ran a few tests and my results are consistent with yours.

                Export of RTF tables fails for HTML, PDF, and Word.

                Specification of fixed width font fails as well.

                Looks like you'll have to use native DOORS tables or OLE Objects of Word or Excel. Note that an extra wrinkle with OLE objects is big ones (over a pages worth won't do page breaks).

                I tend to use native DOORS tables because they export better.

                I use small Word OLE objects if anything other than fixed width font would look messy (for example, output from a text-based database client like SqlPlus where text alignment depends on a fixed width.) I really wish you could specify fixed width override for a given Object Text but you can't.
  • Huyi.Wang
    Huyi.Wang
    6 Posts
    ACCEPTED ANSWER

    Re: Is there a way to display a table?

    ‏2012-04-20T13:13:05Z  in response to Huyi.Wang
    1. Use RTF table
    2. obj.attrDXLName = richText(Results)