0

DOORS モジュールからいくつかの属性と発信リンクを読み取り、それを MS Excel シートに書き込む DXL 関数を作成しました。それは正常に動作します。

ここで、DXL 関数に以下を追加したいと思います。

DOORS モジュールを開いてフィルターを適用すると、[リンク] > [リンクモジュールを通過します] と言って特定のモジュールを選択できます。(私はドイツの DOORS バージョンを持っているので、少し違う名前になっているかもしれません)

これは私が現時点で持っている機能です:

void WriteAllOutLinksToExcel (string sModuleName, string sBookName, string sSheetName)
{
    OleAutoObj  objExcel = oleGetAutoObject("Excel.Application")
    OleAutoObj  objBook
    OleAutoObj  objSheet = null
    OleAutoArgs oleArgs = create
    Object  oCur
    Module  mCur
    bool        excelVisible 
    string  sTemp = ""
    string  sResult = ""
    string  sNum
    int         iRow = 1
    int     iCount = 0
    int         iNum
    Link        lref
    ModName_    targetMod

    oleGet(objExcel, "Visible", excelVisible);
    if (!excelVisible) olePut(objExcel,"visible",true);

    sResult = oleGet(objExcel,"Workbooks", sBookName);

    clear oleArgs;
    put(oleArgs, sSheetName);
    sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet);

    mCur = edit(sModuleName,false);
    if(mCur != null)
    {
        View v = view("_ABC");
        for oCur in mCur do
        {
            // Absolute object no..
            sTemp = oCur."Absolute Number";
            objCell = ExcelGetCell(objSheet, iRow, 1);
            olePut(objCell,"Value",sTemp);          

            // Object text
            sTemp = oCur."Object text";
            objCell = ExcelGetCell(objSheet, iRow, 2);
            olePut(objCell,"Value",sTemp);          

            // Links
            iCount = null;
            for lref in oCur -> "*" do {    
                targetMod = target lref;
                iNum = targetAbsNo(lref);
                sNum = " " iNum " ";
                if(iCount == 0)
                {
                    sTemp = fullName(targetMod) sNum;
                }
                else
                {
                    sTemp = sTemp "\n" fullName(targetMod);
                    sTemp = sTemp sNum;
                }
                objCell = ExcelGetCell(objSheet, iRow, 3);
                olePut(objCell,"Value",sTemp);
                iCount ++;
            }           
            iRow ++;
        }
    }
    close(mCur);
    oleCloseAutoObject (objExcel);
}

forループ内のifステートメントのようなものを考えています:「リンクモジュール「abc」が渡された場合、情報「オブジェクト番号」と「オブジェクトテキスト」とリンクをリストします...

これは可能ですか?誰かがこれで私を助けてくれることを願っていますか?

4

1 に答える 1

0

あなたがする必要があるのは、パラメーターを入力に追加することだけです(ここで追加しましたstring LinkModName)。はすべてのリンク モジュールを示していますが、使用する特定のリンク モジュールの文字列名に置き換えることができます。また、リンク モジュールのフル パスを関数に渡すようにしてください。"*"LinkModName"*"

お気に入り:/Project_Name/Folder_Name/Link_Module_Name

void WriteAllOutLinksToExcel (string sModuleName, string sBookName, string sSheetName, string LinkModName)
{
  OleAutoObj  objExcel = oleGetAutoObject("Excel.Application")
  OleAutoObj  objBook
  OleAutoObj  objSheet = null
  OleAutoArgs oleArgs = create
  Object  oCur
  Module  mCur
  bool        excelVisible 
  string  sTemp = ""
  string  sResult = ""
  string  sNum
  int         iRow = 1
  int     iCount = 0
  int         iNum
  Link        lref
  ModName_    targetMod

  oleGet(objExcel, "Visible", excelVisible);
  if (!excelVisible) olePut(objExcel,"visible",true);

  sResult = oleGet(objExcel,"Workbooks", sBookName);

  clear oleArgs;
  put(oleArgs, sSheetName);
  sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet);

  mCur = edit(sModuleName,false);
  if(mCur != null)
  {
     View v = view("_ABC");
     for oCur in mCur do
     {
        // Absolute object no..
        sTemp = oCur."Absolute Number";
        objCell = ExcelGetCell(objSheet, iRow, 1);
        olePut(objCell,"Value",sTemp);          

        // Object text
        sTemp = oCur."Object text";
        objCell = ExcelGetCell(objSheet, iRow, 2);
        olePut(objCell,"Value",sTemp);          

        // Links
        iCount = null;
        for lref in oCur -> LinkModName do {    
            targetMod = target lref;
            iNum = targetAbsNo(lref);
            sNum = " " iNum " ";
            if(iCount == 0)
            {
                sTemp = fullName(targetMod) sNum;
            }
            else
            {
                sTemp = sTemp "\n" fullName(targetMod);
                sTemp = sTemp sNum;
            }
            objCell = ExcelGetCell(objSheet, iRow, 3);
            olePut(objCell,"Value",sTemp);
            iCount ++;
        }           
        iRow ++;
    }
  }
  close(mCur);
  oleCloseAutoObject (objExcel);
}

お役に立てれば!

于 2013-10-23T11:35:12.563 に答える