Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 3.29 KB

report-wordxmlpart-method.md

File metadata and controls

72 lines (55 loc) · 3.29 KB
title description ms.author ms.date ms.topic author ms.reviewer
Report.WordXmlPart(Integer [, Boolean]) Method
Returns the report data structure as structured XML that is compatible with Microsoft Word custom XML parts.
solsen
05/14/2024
reference
SusanneWindfeldPedersen
solsen

Report.WordXmlPart(Integer [, Boolean]) Method

Version: Available or changed with runtime version 1.0.

Returns the report data structure as structured XML that is compatible with Microsoft Word custom XML parts. The method has an instance call and a static call. The following code shows the syntax of the WORDXMLPART function. The first line of code is the syntax for an instance method call. The second line of code is the syntax for a static method call.

Syntax

String :=   Report.WordXmlPart(Number: Integer [, ExtendedFormat: Boolean])

Parameters

Number
 Type: Integer
The ID of the report that you want to run. If the report you specify does not exist, then a run-time error occurs.

[Optional] ExtendedFormat
 Type: Boolean
If you set this variable to true, then XML elements will include the following attributes:

  • ElementType="Parameter|Column|DataItem". Specifies the element type as defined for the report in Report Designer. Parameter is typically used for elements, such as captions.
  • ElementId="ID". Specifies the ID that is assigned to the element by its ID Property.
  • DataType="Type". Specifies the data type of the element. If you omit this parameter or set it to false, then the element attributes are not included in the XML. This is the recommended setting when you will use the Word XML part in Word for modifying the report layout because the XML is simpler. The following example illustrates an XML element that has the ExtendedFormat set to true: <CompanyName ElementType="Column" ElementId="3" DataType="OemText"> The following example illustrates the same XML with the ExtendedFormat set to false:<CompanyName>

Return Value

String
 Type: Text
The report data structure as structured XML that is compatible with Microsoft Word custom XML parts.

Remarks

[!INCLUDEWordXmlPart]

Example

[!INCLUDEexample-1]

var
    ReportAsXmlString: Text;
begin
    ReportAsXmlString := MyReport.WordXmlPart(Report::MyReport);  
end;

[!INCLUDEexample-2]

Note

The first parameter in WordXmlPart is an integer which represents the object ID of the report. To code robustly, never supply the object ID directly in your code. Instead, use the :: operator as illustrated in the example above. With this technique, if the report does not exist, you'll get a compile time error instead of a runtime error.

See Also

Report Data Type
Get Started with AL
Developing Extensions