Six or seven years ago, I used a DXL script that was a very slight modification of the standard DOORS library Word export utility. The script was handed off to me, so I don't remember the exact modifications. Using "Paragraph Style" and a customized Word template (not normal.dot), table and figure captions were created in the Word document. Those captions were objects in DOORS with Paragraph Style attributes identifying them as table or figure captions. I remember the captions in Word being actual Word captions with field codes (i.e. you could update them if you added/deleted/moved figures or update the list of tables or figures to automatically capture all the tables or figures in the document). Now, I am second guessing myself because I cannot seem to reproduce this functionality. I do not have the modified script or template, but running the DOORS 9.5 version of the DOORS library Word export utility with a different template and using "Paragraph Style" exports objects identified as table or figure captions to the associated caption style in the template. However, the number in the text that would be a field code is not a field code. Is what I remember possible? Obviously, without the actual DXL script I ran and the template I used, this is going to be impossible to know for certain, but I want to know if doing what I describe is possible; my memory may be incorrect. Could you modify the standard DOORS library Word export utility DXL to generate table and figure captions with field codes in Word? Is there something in the template that has to be set up a certain way? Maybe the table and figure caption styles in the template have to be based on the existing "Caption" style, or something similar. If not, I imagine you could write a VBA script to do this, but I simply don't remember having to do that years ago.
Any suggestions are appreciated.
Thank you, Matt AB981 - Tue Dec 18 20:26:18 EST 2018 |
Re: DOORS export to Word - Table and Figure captions Dunno about exporting that way, but I've certainly built VBA in Word to find, format, and caption Tables and Figures exported from DOORS. |
Re: DOORS export to Word - Table and Figure captions I think we may be in similar situations. I have a dxl I updated to include figure and table captions using the paragraph style. I can export this to Word using a special template. Word can then create the Table of Figures and Table of Tables for me using standard field commands. I have not explored this enough, or learned enough perhaps, to have word update the tables and figures field codes for me for each table/figure. I could send you my dxl if it helps, but it sounds like you already have the functionality I described? |
Re: DOORS export to Word - Table and Figure captions STower - Mon Feb 11 17:22:14 EST 2019 I think we may be in similar situations. I have a dxl I updated to include figure and table captions using the paragraph style. I can export this to Word using a special template. Word can then create the Table of Figures and Table of Tables for me using standard field commands. I have not explored this enough, or learned enough perhaps, to have word update the tables and figures field codes for me for each table/figure. I could send you my dxl if it helps, but it sounds like you already have the functionality I described? Yes it sounds like we both have the same functionality. With the Word template I have, I am able to generate a List of Figures and List of Tables that includes all the correct Figure and Table captions. The only thing I cannot do is have those caption numbers generated as field codes. |
Re: DOORS export to Word - Table and Figure captions I have worked on a modified WEXP script for a number of years. The code below should get you started. It works by calling the Word OLE "InsertCaption" function. Note that this code assumes that the global variables objDoc and objSel have already been configured. This are OleAutoObj objects representing the ActiveDocument and Selection objects from the Word OLE interface. // wdCaptionLabelID enumeration const int wdCaptionEquation = -3; const int wdCaptionTable = -2; const int wdCaptionFigure = -1; // wdCaptionPosition enumeration const int wdCaptionPositionAbove = 0; const int wdCaptionPositionBelow = -1; /** * @memberof WEXP * @brief Inserts a caption of the specified type to the document. * * @remarks Added to support cross-referencing to Tables and Figures. * * @param[in] captionLabel The caption type - Figure or Table. * @param[in] caption The caption text. */ void WEXP_insertCaption(string captionLabel, string caption) { int wdCaptionLabel = 0; if (captionLabel == "Figure") { wdCaptionLabel = wdCaptionFigure; } else if (captionLabel == "Table") { wdCaptionLabel = wdCaptionTable; } if (wdCaptionLabel != 0) { // VBA code // Selection.MoveLeft Unit:=wdCharacter, count:=labelLength, Extend:=wdExtend // Selection.InsertCaption Label:=captionType, TitleAutoText:="InsertCaption2", _ // Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0 // Selection.Style = ActiveDocument.Styles(captionLabel) clear objArgBlock; put(objArgBlock, "Label", wdCaptionLabel); put(objArgBlock, "Position", wdCaptionPositionBelow); put(objArgBlock, "ExcludeLabel", false); put(objArgBlock, "Title", caption); oleMethod(objSel, "InsertCaption", objArgBlock); } } bool WEXP_exportText(Object o) { // ^ // | // This is not the complete function // This is only showing an snippet of the required code string captionText if (styleName == "Figure" || styleName == "Table") { // Check if the text needs to have the Figure / Table removed from caption text Regexp regEx = regexp2("(Figure|Table)([ \t]*[^ \t]*)[ \t\\-:]*((.|\n)*)$"); string txt = o."Object Text"; if (regEx txt) { // Get the last part of the caption (with the Table/Figure number removed) string edited = ": " txt[match 3]; captionText = richText(edited); } else { captionText = richText(txt); } WEXP_insertCaption(styleName, ""); WEXP_wordSendText(captionText, styleName); } // Rest of function is not shown // // | // V }
|
Re: DOORS export to Word - Table and Figure captions If you were using WEXP, then it is important to also set the "WEXP Caption" attribute. It was that one which triggered the creation of the Word field code, not the "Paragraph Style" Cheers, Peter |
Re: DOORS export to Word - Table and Figure captions Peter_Albert - Wed Mar 20 09:01:00 EDT 2019 If you were using WEXP, then it is important to also set the "WEXP Caption" attribute. It was that one which triggered the creation of the Word field code, not the "Paragraph Style" Cheers, Peter The version of WEXP we are using no longer uses the WEXP Caption attribute. |