AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
CRM
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.04.2008, 20:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,506 / 847 (80) +++++++
Регистрация: 28.10.2006
dax-lessons: Create HTML using HtmlTextWriter class in x++
Источник: 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
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dax-lessons: Create Outlook Appointment or Meeting Request using X++ Blog bot DAX Blogs 0 30.04.2008 23:07
dax-lessons: Create Technical Document from AX Blog bot DAX Blogs 0 12.03.2008 09:05
dax-lessons: Document Handling in AX - setup and Example Blog bot DAX Blogs 0 27.08.2007 23:00
dax-lessons: Active directory in Axapta Blog bot DAX Blogs 0 27.08.2007 23:00

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:07.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.