将文本字符串添加到传递报告。 支持的平台:仅窗口 Namespace:传输利布 组装:acETransmit20.tlb 签名VB.NET: RetVal = object.addToReport(bstrTextToAdd, nIndex) C#: RetVal = object.addToReport(bstrTextToAdd, nIndex);
返回值(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();
}
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 06:01
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.