如何将HTML转换为格式化文本,以使间距,表格边框,元素定位等布局保持不变?



如何将HTML转换为格式化文本,以使间距,表格边框,元素定位等布局保持不变?有没有相同的工具?

已经尝试了一些选项,如下所示,但输出格式不符合预期:

  1. Txt控制转换
  2. PythonCom转换

问题:转换单元格之间有间距的 HTML 表格会导致单元格内容移动到下一行,从而干扰格式。 预期输出为:表格行单元格内容应在同一行中,文本文件中的边框应保持不变。

此外,PDF/RTF 到文本的转换也可以正常工作,只是格式应该完好无损。

附加屏幕截图以更清楚地说明要求。 输入 HTML 屏幕截图

输出文本屏幕截图

或者,有没有办法逐个字符读取 HTML 并写入文本文件,以便布局在文本输出中不会改变。

这行得通吗?

您可以将HTML转换为BBCode,并且您有一个RTF编辑器。

http://www.ecardmax.com/hoteditor/

只需确保选中 HTML 复选框,以便您可以将 HTML 插入其中。因此,当您粘贴文本时,请选择HTML部分,您应该同时尝试两者。

 

这是您在BBCode上的帖子的结果

请注意,这是我编辑的版本:

How to [B]convert[/B] HTML into formatted Text, so that the layout such as spacing, table borders, element positioning remains intact? Is there any tool for the same?
Tried a few options already as follows but output formatting is not as desired:
[LIST=1]
[*]TxtControl conversion
[*]PythonCom conversion[/LIST]
[B]Issue:[/B] Converting HTML table with spacing between cells resulting in cell content getting moved to next line hence disturbing the formatting.Expected output is : Table row cell content shall be in same line and border shall be intact in text file.
Also, PDF/RTF to TEXT conversion will also work just formatting should be intact.

可能是您需要手动从中删除某些内容,例如,我必须删除名为"感谢您的编辑!"的文本,该文本在您编辑某些内容时出现并且它仍处于待处理状态。

如果您想转换无法再在 XenForo 上访问的旧帖子,这将非常有用。

然后,您可以将其放入文本替换器中,在那里它可以将[B]替换为**

最新更新