Источник:
http://DAX-Lessons.spaces.live.com/B...FCD1!143.entry
==============
HtmlTextWriter class is used to output properly formed HTML into a web page. The HtmlTextWriter allows the developer to code attributes, style attributes, and tags etc.
The HtmlTextWriter class permits the developer to generate page output in a non-browser specific way; that is to say, the burden of developing alternative markup is typically removed by using the HtmlTextWriter. The HtmlTextWriter class exposes properties, fields, and methods that permit the developer to format HTML 4.0 compliant output.
For example, in the job below i added static string and an image using the HtmlTextWriter class.
X++:
static void HTMLTextWriter(Args _args)
{
HTMLTextWriter htw = new HTMLTextWriter();
TextBuffer txtBuffer = new TextBuffer();
CCHTMLString staticString;
;
staticString = @'At Solugenix we know our success results from taking a long term view in all
our relationships: clients, employees, industries and technologies.';
htw.renderBeginTag(HtmlTextWriterTag::table());
htw.renderBeginTag(HtmlTextWriterTag::tr());
htw.write(staticString);
htw.addAttribute(HtmlTextWriterAttribute::class_Attribute(), 'ms-vb');
htw.addStyleAttribute(HtmlTextWriterStyle::width(), '26px');
htw.addStyleAttribute(HtmlTextWriterStyle::padding_top(), '3px');
htw.renderBeginTag(HtmlTextWriterTag::td());
htw.addAttribute(HtmlTextWriterAttribute::src(), 'http://www.holidayegreetingssite.com/index_files/image3121.jpg');//get the image from web
htw.addStyleAttribute(HtmlTextWriterStyle::width(), '100');
htw.addStyleAttribute(HtmlTextWriterStyle::height(), '50');
htw.renderBeginTag(HtmlTextWriterTag::img(), true);
htw.renderEndTag(); //close
htw.renderEndTag(); //close
txtBuffer.setText(htw.getHtmlString());
txtBuffer.toFile('f:\DynamicsAX.html'); // please provide your path to save the file
}
The result of the above code will be -

Источник:
http://DAX-Lessons.spaces.live.com/B...FCD1!143.entry