CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

AddToReport Method (ActiveX/ATO)

2023-1-1 23:00| 发布者: admin| 查看: 172| 评论: 0|来自: AutoCAD

摘要: 将文本字符串添加到传递报告。

将文本字符串添加到传递报告。

支持的平台:仅窗口

Namespace:传输利布

组装:acETransmit20.tlb

签名

VB.NET:

RetVal = object.addToReport(bstrTextToAdd, nIndex)

C#:

RetVal = object.addToReport(bstrTextToAdd, nIndex);
对象

类型:传递操作对象

此方法适用的对象。

bstrTextToAdd

访问:仅输入

类型:字符串

要添加到传递报告的文本字符串。

n索引

访问:仅输入

类型:

传输报告中应在其中添加文本字符串的存储区域的索引。

如果没有索引号,请使用值 -1。

返回值(RetVal)

类型:

传递报告中添加了文本字符串的存储区域的索引。

言论

没有额外的评论。

发布信息

释放:AutoCAD 2004 及更高版本

例子

VB.NET:

' Custom command that creates a transmittal package and adds a transmittal report
<CommandMethod("eTransmitCustomReport")> _
Public Shared Sub eTransmitCustomReport()

    ' Create a transmittal operation
    Dim tro As TransmittalOperation = New TransmittalOperation()

    ' Setup the transmittal behavior
    Dim ti As TransmittalInfo = _
        TransInfo(tro.getTransmittalInfoInterface(), "C:\Users\Public\TransmittalAPITest\")

    ' Add a file notification handler
    Dim fileHandler As New MyTransFileNotifier
    tro.subscribeToAddFileNotification(fileHandler)

    ' Setup the progress meter to monitor the files being added to the
    ' transmittal set from the sheet set
    Dim pmHandler As New MyProgressHandler
    tro.setProgressMeter(pmHandler, 1)

    ' Add a sheet set
    TransAddFile(tro, "C:\AutoCAD\Sample\Sheet Sets\Architectural\IRD Addition.dst", FileType.SheetSet)

    ' Append text to the transmittal report
    Dim nFirstSection As Integer = -1
    nFirstSection = tro.addToReport("Custom First Section:", nFirstSection)
    tro.addToReport(Environment.NewLine & "First line of first custom section.", nFirstSection)

    ' Append text to the transmittal report
    Dim nSecondSection As Integer = -1
    nSecondSection = tro.addToReport(Environment.NewLine & "Custom Second Section:", nSecondSection)
    tro.addToReport(Environment.NewLine & "First line of second custom section.", nSecondSection)

    ' Append text to the first section
    tro.addToReport(Environment.NewLine & "Second line of first custom section.", nFirstSection)

    ' Get the transmittal report
    Dim tr As String = tro.getTransmittalReport()

    ' Write the transmittal report to the file "transmittal report.txt" in the
    ' destination root of the transmittal package
    writeReport(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + _
                "\transmittal report.txt", tro.getTransmittalReport())

    ' Add the report to the transmittal package
    Dim tf As TransmittalFile = TransAddFile(tro, _
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + _
                "\transmittal report.txt", FileType.Unknown, Nothing)

    ' Change the path of the transmittal report
    tf.targetSubPath = ""

    ' Remove the file notification handler
    tro.cancelSubscriptionToAddFileNotification(fileHandler)

    ' Create the transmittal package
    ' Files are copied and resaved to the path specified by the destinationRoot property
    ' and the other settings of the TransmittalInfo object.
    tro.createTransmittalPackage()
End Sub

C#:

// Custom command that creates a transmittal package and adds a transmittal report
[CommandMethod("eTransmitCustomReport")]
public static void eTransmitCustomReport()
{
    // Create a transmittal operation
    TransmittalOperation tro = new TransmittalOperation();

    // Setup the transmittal behavior
    TransmittalInfo ti = TransInfo(tro.getTransmittalInfoInterface(),
                                   "C:\\Users\\Public\\TransmittalAPITest\\");

    // Add a file notification handler
    MyTransFileNotifier fileHandler = new MyTransFileNotifier();
    tro.subscribeToAddFileNotification(fileHandler);

    // Setup the progress meter to monitor the files being added to the
    // transmittal set from the sheet set
    MyProgressHandler pmHandler = new MyProgressHandler();
    tro.setProgressMeter(pmHandler, 1);

    // Add a sheet set
    TransAddFile(tro, "C:\\AutoCAD\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst",
                 FileType.SheetSet);

    // Append text to the transmittal report
    int nFirstSection = -1;
    nFirstSection = tro.addToReport("Custom First Section:", nFirstSection);
    tro.addToReport(Environment.NewLine + "First line of first custom section.", nFirstSection);

    // Append text to the transmittal report
    int nSecondSection = -1;
    nSecondSection = tro.addToReport(Environment.NewLine + "Custom Second Section:", nSecondSection);
    tro.addToReport(Environment.NewLine + "First line of second custom section.", nSecondSection);

    // Append text to the first section
    tro.addToReport(Environment.NewLine + "Second line of first custom section.", nFirstSection);

    // Get the transmittal report
    string tr = tro.getTransmittalReport();

    // Write the transmittal report to the file "transmittal report.txt" in the
    // destination root of the transmittal package
    writeReport(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                "\\transmittal report.txt", tro.getTransmittalReport());

    // Add the report to the transmittal package
    TransmittalFile tf = TransAddFile(tro,
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                "\\transmittal report.txt", FileType.Unknown, null);

    // Change the path of the transmittal report
    tf.targetSubPath = "";

    // Remove the file notification handler
    tro.cancelSubscriptionToAddFileNotification(fileHandler);

    // Create the transmittal package
    // Files are copied and resaved to the path specified by the destinationRoot property
    // and the other settings of the TransmittalInfo object.
    tro.createTransmittalPackage();
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-28 02:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部