You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Apps富文本多级项目符号转纯文本符号适配Power Automate

问题
  • 场景:无第三方连接器,通过Power Automate从SharePoint列表取数创建Word文档,而SharePoint列表的数据来自Power Apps表单。
  • 核心矛盾:Power Apps用户需要在输入中添加项目符号,但Power Automate仅支持处理纯文本。

拟定解决方案

在Power Apps表单中设置两个字段:

  • 名为RichInput的富文本字段,供用户输入带项目符号的内容
  • 名为PlainInput的隐藏纯文本字段,用于存储转换后的纯文本

需要编写Power Fx代码实现:

  • 识别RichInput中的一级项目符号,替换为星号*
  • 识别RichInput中的二级嵌套项目符号,替换为连字符-
  • 将转换后的结果存入PlainInput,方便Power Automate处理

尝试过的代码(未达到预期效果)

With(
    {
    htmlContent: RichText.HtmlText
    },

    // 2. Split into Lines
    With(
        {
        linesTable: Split(htmlContent, Char(10)) // Split by newline character
        },

    // 3. Iterate and Modify (and 4. Reconstruct)
    Set(
        varModifiedHtml, // A variable to store the modified HTML
        Concat(
            ForAll(
                linesTable,
                If(
                    "</ul></li></ul>" in ThisRecord.Value,
                    "-" & ThisRecord.Value, // Prepend hyphen
                    ThisRecord.Value
                    )
                ),
            Value,
            "<br>" // Rejoin with HTML line breaks
            )
        )
    )
);

恳请提供可行的Power Fx代码实现上述转换需求。

内容的提问来源于stack exchange,提问作者Jarrell Cathcart

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 13:52:37