BarApp := CreateOleObject('lppx.Application'); //
  BarApp.Visible := true; //
  BarDoc := BarApp.ActiveDocument;
  S := ExtractFilePath(Application.ExeName) + 1.lab;
  BarDoc.Open(S);
  BarDoc.Variables.item('MA').Value
  BarDoc.Variables.item('MB').Value
  BarDoc.Variables.item('MC').Value
  
  这个是调用1.lab这个模版打印;
  请问应该怎么才能获取得1.lab里面有几个变量呢?

解决方案 »

  1.   

    Codesoft好像不支持这种方式吧...用别的软件可以.
    labelmatrix.好像是这么拼的!可以直接调用模板.
      

  2.   

    支持这种方式的,
      BarApp := CreateOleObject('lppx.Application'); //
      BarApp.Visible := true; //
      BarDoc := BarApp.ActiveDocument;
      S := ExtractFilePath(Application.ExeName) + 1.lab;
      BarDoc.Open(S);   for i := 1 to BarDoc.Variables.Count do //变量的数量
        begin
          ListBox.AddItem(BarDoc.Variables.item(i).Name, nil);
        end;   BarDoc.Variables.item(i).Name //这个可能获得里面的变量