Excel - 使用VBA刮取HTML源布局

问题描述 投票:0回答:1

我有一些非常设计的HTML,我试图将数据从中轻松读取。

我可以使用innerHTML来获取信息,但遗憾的是它出现在一面文字中。

当我“查看源代码”(为隐私而更改的词语)时,来自网页的来源示例是:

<td nowrap valign="top"><b>Logger Notes</b></td>
    <td valign="top">Hi,
Person needs a full breakdown Important information.
Would also would like confirmation in a letter about what kinds of assistance 
she is not eligible for if possible.
Would prefer sent to email.
Thanks&nbsp;</td>

然而,当我得到数据时,它就像一面文字一样:

Hi, Person needs a full breakdown Important information. Would also would like confirmation in a letter about what kinds of assistance  she is not eligible for if possible. Would prefer sent to email. Thanks

这显然更难阅读。

当我使用innerHTML并查看字符串时,所有换行符都是空格字符,所以我不能使用replace

我搜索并尝试了很多不同的东西,但我无法找到一种方法来显示它,因此它很容易阅读。

该网页位于我们的工作内部网上,并且已登录(使用电子表格的多人将使用 - 因此我无法自动执行此操作)

首选输出示例:

Hi,

Person needs a full breakdown Important information.

Would also would like confirmation in a letter about what kinds of assistance she is not eligible for if possible.

Would prefer sent to email.

任何意见,将不胜感激。

excel vba excel-vba
1个回答
0
投票

也许,在每次出现一段时间后添加一个换行符?

例如,replace".""." & vbCrLf

© www.soinside.com 2019 - 2024. All rights reserved.