貼上在 Word for Mac 2011 中

貼上在 Word for Mac 2011 中

如果我創建一個帶有簡單 <pre> 格式文字的 HTML 文檔


<body>
<p>This is a test
<ul>
    <li>this is an item
    <li>this is another
    <li>this is the third
</ul>
<p>
<pre>
{ "firstName": "John",
  "lastName": "Smith",
  "age": 25 }
</pre>
</body>

在 Chrome 中開啟它,並將其貼到 MS Word 2011 中,它的 <pre> 中沒有換行符:

在此輸入影像描述

OTOH,如果我在 LibreOffice 中執行相同的粘貼,則 <pre> 會被保留。奇怪的是,如果我選擇只是<pre> 中的區域,並貼上為文本,換行符將被保留。

有誰知道無需手動重新格式化所有 <pre> 內容即可完成這項工作的技巧?

相關內容