问题标签 [trichedit]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
delphi - 如何在 TRichEdit 的顶部插入新的、未格式化的行
我正在使用 TRichEdit 来保存电子邮件客户端的正文。我为用户提供了简单的格式设置功能(粗体、斜体、下划线、左、中和右段落对齐和项目符号。这适用于使用 Indy在此处按照 Remy 的代码将格式化文本作为 html 电子邮件发送。
我将 TRichEdit 文本提取为 html 使用
就在我发送电子邮件之前,我使用代码在 TRichEdit 中插入一个称呼字符串作为新的顶行,然后是两个空行。电子邮件系统使用它来个性化电子邮件,并且效果很好。
问题是,如果用户在输入正文时格式化了正文的第一行,例如,假设他们将前几行设为项目符号列表,那么我在代码下添加的称呼行也会在电子邮件到达时显示为项目符号。
如何使用代码在 TRichEdit 的顶部插入没有段落或字体格式的行,同时保留用户可能已应用于手动输入的第一行(什么是)的任何格式?
我现在用来插入我的称呼字符串的代码如下,但我的称呼仍然获得用户应用的格式样式。(最初我只有三个插入行,但在类似的问题中添加了其他代码)。大写的标识符是在别处定义的常量。
附录:
我设法通过延迟称呼插入来获得我想要的结果,直到我设置好准备传递给 Indy 的参数并将整个 TRichEdit HTML 附加到一个简单的文本字符串,而不是
我用了
其中 body 是 TRichEdit。
但是,我仍然想知道我的问题是否可以通过直接在 TRichEdit 中插入新行来解决。
delphi - 如何遍历 TRichEdit 文本的每个可见字符?
在 Delphi 10.3.3 中,这是循环遍历(多行)文本的每个可见Char
(即排除不可打印字符,例如 eg )的最简单、最快和最有效的方法?然后我需要根据我的计算来获取和设置每个字符的颜色。#13
TRichEdit
我试过这个:
但我相信一定有更好的方法。
c++ - 如何获得 TRichEdit 的进度?
我有一个简单的“粗鲁”大文本文件(20MB)。我想在 TRichEdit 中展示它。问题是显示需要 6 秒。我想在应用程序的底部放置一个进度条,以避免这种糟糕的用户体验设计。
我的问题是如何获得 TRichEdit 显示的进度?使用 TRichEdit::LoadFromStream 方法,它从 0 到 100% 快(不到 1 秒),但在第一次显示期间应用程序等待 6 秒后。
我用 TFileStream 继承创建了这个类 FileStreamProgress。我覆盖了 TFileStream::Read()
这就是我测试它的方式:
2 个消息对话框“111”和“222”之间有 7 秒。我的进度条在 100% 处等待 6 秒(在显示期间)
delphi - TRichEdit 中混合西方和亚洲字符
(德尔福 XE4/Win 7)
当同时显示西方和亚洲字符时,TRichEdit 组件的行为很奇怪。演示程序(表单、列表框、richedit,默认设置来自 Object Inspector;从日本网站复制的亚洲字符):
演示运行:
在列表框中,所有西方字符都具有正确且相同的大小。然而,在 Richedit 中,西方字符只有在前面没有亚洲字符时才能正确显示。否则,所有后面的西方字符都以缩小的尺寸显示。
注意:如果您在程序运行时编辑文本,插入的西方字符将以正确的大小显示 - 无论它们插入的位置如何(插入的字符标记为红色):
有没有办法在richedit中正确显示西方和亚洲字母的文本?需要做什么才能使其发挥作用?提前感谢您的帮助!
hyperlink - How to include the last word of hyperlink text in TRichEdit in the blue, underline format of the rest?
I'm using a TRichEdit to edit text. I then use TJvRichEditToHtml to convert the text to HTML which then gets sent as the body of an email via Mailgun. I'd like to include hyperlinks in the text that gets emailed.
Following this SO post, and several other similar ones, I included the code below to insert a formatted hyperlink in the TRichEdit at the insertion point. As expected, that hides the URL and shows the link text as blue, underlined text just as I wanted. i.e. if I insert the url https://stackoverflow.com
, with the text this is a link
, the HTML will contain
HYPERLINK "https://stackoverflow.com/"this is a link
and the Rich text box shows this is a link
all in blue and underlined.
Just before sending the body to Mailgun I then substitute HYPERLINK "
with <a href="
and "
with "
to get the html <a href="https://stackoverflow.com/">this is a link
To identify the end of the link text, so that I can substitute </a>
and close the html hyperlink properly, I added code to append a hidden text token ENDHYPERLINK
after the hypertext link in the TRich edit which I then substitute for </a>
. ie the html before substitution look like HYPERLINK "https://stackoverflow.com/"this is a link ENDHYPERLINK
and after substitution looks like <a href="https://stackoverflow.com/">this is a link</a>
However, when I add this extra text after the hyperlink, although it is correctly invisible in the TRichEdit, the blue underlining of the link text in the TRichEdit shrinks back so that the last word of the hyperlink text is no longer formatted in blue underline (no matter how long the hyperlink text is or how long the last word is) i.e I get this is a
and the space char in blue and underlined but not the word link
Can someone help me to append my ending token but still get all of the original hyperlink text shown formatted?
Code used to insert the hyperlink - before adding my ending token - this displays OK.
Code used to insert the hyperlink but also append a closing token - this loses formatting of the last word in the link text.
Note This question is not about being able to click the links in the TRichEdit and get sent to the web site, so is not a duplicate of many others (Although I have written the code to do this by overriding WndProc, which works OK even though my last word is not shown formatted correctly)
delphi - 使用 Delphi 的 TRichEdit,有没有办法设置“链接”,以便有人可以单击它来打开文件?
我在 Delphi 应用程序中执行一种 grep,用户可以在其中搜索文件夹中的某些文件以查找搜索词。然后在 TRichEdit 中,对于每个匹配的文件,我将显示一个文件名,并在其下方显示包含搜索词的行。
我希望能够让文件名像热链接一样,所以如果你点击它,它将以系统默认值打开文件。它们通常只是文本文件,所以我也可以在 Notepad++ 中打开它们。
我知道这可以在 TRichView 中完成,但我无法在此处访问它。在 RV 中,您可以让任何文本看起来像一个 URL,当单击它时,您可以对它做任何您想做的事情。最后我检查了一下,常规的 RichEdit 控件仅将它们视为 Web URL,并且只允许您将它们路由到 Web 浏览器。Delphi 从来没有对这些标准的 Windows 控件进行太多更新,并且没有很好的文档记录。所以我想知道是否有人肯定知道这一点。
万一这很重要,我在 Windows 10 上使用 Delphi 10.2.3 (Tokyo)。
delphi - 如何在设计时将格式丰富的文本分配给 Delphi TRichEdit 或 TcxRichEdit(可能使用 Lines 属性)?
我只想在设计时将不可变的、格式丰富的文本分配给 RichEdit(或 DevExpress cxRichEdit,显然是从 VCL RichEdit 继承的)。我知道如何在运行时使用选择文本并为此选择设置属性来进行大量格式化。但我不需要这种灵活性——我只是有一些粗体字的长文本,不需要在运行时修改它,这是给用户的一些信息/文档。
如何在设计时分配此类文本?RichEdit 没有用于 Lines 属性的复杂编辑器(至少我找不到它)。我尝试在 Word 中创建 RTF 文档,然后将其值(带有 RTF 标记的文本)复制粘贴到 Lines 属性中,但 RichEdit 显示了所有 RTF 标记。此外,Word 添加了大量的 RTF 附加信息,而不仅仅是一些 RTF 标签。
如何在设计时添加格式化文本?
delphi - Delphi 11 TRichEdit 超链接停止工作
我使用这个线程向我的TRichEdit
组件添加超链接。但是,自从安装了新的 Delphi 11 后,它们就停止了工作。
有人知道为什么吗?