![刷新时两次下载来自网络的 Word 图像](https://linux22.com/image/1567325/%E5%88%B7%E6%96%B0%E6%97%B6%E4%B8%A4%E6%AC%A1%E4%B8%8B%E8%BD%BD%E6%9D%A5%E8%87%AA%E7%BD%91%E7%BB%9C%E7%9A%84%20Word%20%E5%9B%BE%E5%83%8F.png)
我正在用 Java 开发一个服务器 (NanoHTTPD),它发布一个图像。然后打算将该图像加载到 MS Word 中,其中已经有一个 Image 对象,可以通过按 F9 重新加载。
它运行良好,尽管出于某种原因,Word 在单次刷新时会加载两次图像。这给了我在服务器端的用户日志中的两个条目。当然,这是一个很小的细节,但我不喜欢以一种黑客的方式隐藏第二个日志。
我尝试让服务器添加“连接:关闭”标头,但是,根据 WireShark,Word 只使用两个请求而不是一个会话。
这种行为有什么原因吗?
编辑:
从WireShark可以看出:
GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 13:20:30 GMT Connection: keep-alive Content-Length: 79167 (transfer of PNG) GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 13:20:30 GMT Connection: keep-alive Content-Length: 79167 (transfer of PNG)
服务器关闭连接后:
GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 15:41:06 GMT Connection: close Content-Length: 23434 (transfer of PNG) GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 15:41:06 GMT Connection: close Content-Length: 23434 (transfer of PNG)
答案1
可能相关:
在文件 > 选项 > 高级 > 常规部分(向下滚动)中,选项“打开时更新自动链接”会“自动更新字段和链接“。
如果我理解正确的话,您的图片既是字段又是链接,所以也许这就是它刷新两次的原因。尝试取消选中此选项,然后单击“确定”。