diff --git a/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-universal-styled-string.md b/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-universal-styled-string.md index 853c1fd9e611b0aae6e9515a4a612f28167c4cb2..bd7fe7bd28f6537e89087c6b1fdadff004b58465 100644 --- a/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-universal-styled-string.md +++ b/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-universal-styled-string.md @@ -138,6 +138,36 @@ getStyles(start: number , length: number , styledKey?: StyledStringKey): Array\< | ------- | -------- | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | +### fromHtml + +将HTML格式字符串转换成属性字符串,当前支持转换的HTML标签范围:\

、\、\。仅支持将这三种标签中的style属性样式转换成对应的属性字符串样式。 + +static fromHtml(html: string): Promise\ + +**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------- | ---- | ------------------------------------------------------------ | +| html | string | 是 | html格式的字符串。 | + +**返回值:** + +| 类型 | 说明 | +| ------- | --------------------------------- | +| [StyledString](#styledstring) | 属性字符串。 | + +**错误码**: + +以下错误码详细介绍请参考[通用错误码](../../errorcode-universal.md)。 + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | + ## MutableStyledString 继承于[StyledString](#styledstring)类。