PC SOFT

WINDEV的在线文档

  • The HTML format
  • Edit control in HTML format
  • Overview
  • Notes:
  • Defining the content of an HTML edit control
  • Security mechanism of the HTML edit control
  • Finding out the position of the selection in an HTML edit control
  • Using the RTFxxx functions with an HTML edit control
  • Example: Apply bold formatting to the selected text
  • Saving a text in an HTML file
  • Example
  • Saving text in HTML format in an item of a HFSQL data file
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

The HTML format
The HTML format (HyperText Markup Language) is a tagging language intended for the Web.

WinDev and WebDev allow you to handle text in RTF format via the "RTF format" option of edit controls and via the HTML control.

  • If the text in HTML format is displayed in a control that does not support the HTML format, the tags will be displayed.
  • If the text in HTML format is displayed in a control that supports the HTML format, the tags will be automatically interpreted and the text will be formatted accordingly.
Note: To use an edit control in HTML format, Microsoft Internet Explorer version 6 (or later) must be installed on the computer that runs the application.

Edit control in HTML format

Overview

An HTML edit control is used to display a text in HTML format and to enter a text in HTML format.

When entering a text in an HTML control, this text is automatically stored in HTML format by the control. This text contains all the tags required for the formatting.

Notes:

  • A formatting toolbar can be displayed above the edit control. This toolbar allows the user to easily format the text entered. See HTML formatting toolbar for more details.
  • WinDev For the applications that operate in Windows Vista (or later) or in Tablet PC, you have the ability to include the "Handwritten input" option. This option allows the user to directly enter the text in the control with the stylus or with the mouse. This feature is available by default in the applications that operate on Mobile.
  • If the same text is entered in a standard edit control and in an HTML edit control, the character string found in the HTML edit control will be longer than the string found in the standard edit control (because the HTML tags are added).

Defining the content of an HTML edit control
To define the content of an HTML edit control, all you have to do is assign ..值 by programming (in the initialization code of the control for example).

For example:

// Read an HTML file
HTMLPage字符串型
HTMLPage文件加载文本系统目录系统目录.我的文档)+【"\"】+"index.html"

// Initialize the edit control
EDT_HTMLControlHTMLPage

WinDev

Security mechanism of the HTML edit control

By default, the edit controls in HTML format include a security mechanism against spiteful code.

This mechanism is checked:

  • in the editor via "Allow the execution of scripts" ("General" tab of the control),
  • by programming with ..安全Html.
If the security mechanism is enabled (option unchecked in the editor), all the active elements found in the HTML are locked by default. The active elements are:
  • The Javascript code.
  • The Java applets.
  • The plug-ins (corresponding to the <OBJECT> tags in HTML).
Note: When the ..报表 property of the edit control is equal to 活动, the elements of the controls are in edit and all the active elements are disabled. ..安全Html is useful when the value of ..报表 is equal to 仅显示 or 不活动.

WinDev

Finding out the position of the selection in an HTML edit control

To find out the position of the selection, you must use ..光标 and ..光标结束.

Note: These properties return a value expressed in number of characters displayed in the control (and not in the corresponding HTML code).

WinDev

Using the RTFxxx functions with an HTML edit control

The functions for managing the RTF controls can be used with an HTML edit control. Some specific features must be respected:

FunctionSpecific features
添加链接This function has no effect.
Its use triggers no error.
RTF添加This function cannot be used on the HTML edit controls.
Its use triggers an error.
RTF加载数据This function cannot be used on the HTML edit controls.
Its use triggers an error.
RTF插入数据This function cannot be used on the HTML edit controls.
Its use triggers an error.
RTF查找数据This function cannot be used on the HTML edit controls.
Its use triggers an error.
RTF替换数据This function cannot be used on the HTML edit controls.
Its use triggers an error.
RTF选定数据Only the syntax used to modify the selected text is supported. The syntax taking in parameter the start position and the end position of the text to modify will trigger an error.
RTF转换到文本This function returns the HTML source code.

WinDevWindows

Example: Apply bold formatting to the selected text

The following code, placed in the exit code of an edit control in HTML format, is used to apply the bold attribute to the selected text.

如果EDT_Edit1..光标结束大于EDT_Edit1..光标,那么
RTF选定数据EDT_Edit1RTF.粗体
结束

Saving a text in an HTML file
In an HTML edit control, the text entered is automatically in HTML format.

To save the content of an edit control in HTML format in an HTML file, all you have to do is use 文件保存文本 on the control.

Example

This example is used to create an "index.html" file. This file contains the text entered in the edit control named EDT_HTMLText.

// Select the path and name of the file
FileName字符串型
FileName文件选择器"""""Select a file...",...
"HTML files"+TAB+"*.html"+回车+"All files (*.*)"+TAB+"*.*",...
"HTML"文件选择器.创建+文件选择器.存在

// Backup
文件保存文本FileNameEDT_HTMLText

Saving text in HTML format in an item of a HFSQL data file

To save a text in HTML format in an item of a data file, we advise you to link the edit control to a Text Memo item.

Indeed, as the HTML format includes several tags, a "Character string" item is usually not large enough.