如何保存在线文档html,将文档保存为网页

将文档保存为网页Saving Documents as Web Pages

06/08/2017

本文内容

在 Microsoft Excel 中,可以将工作簿、工作表、图表、区域、查询表、数据透视表、打印区域或自动筛选区域保存到网页中。In Microsoft Excel, you can save a workbook, worksheet, chart, range, query table, PivotTable report, print area, or AutoFilter range to a Web page. 也可以直接在 Excel 中编辑 HTML 文件。You can also edit HTML files directly in Excel.

将文档保存为网页Saving a Document as a Web Page

将文档保存为网页是一个创建并保存 HTML 文件及所有支持文件的过程。Saving a document as a Web page is the process of creating and saving an HTML file and any supporting files. 为此,请使用To do this, use the

ActiveWorkbook.SaveAs _

Filename:="C:\Reports\myfile.htm", _

FileFormat:=xlHTML

自定义网页Customizing the Web Page

您可以通过设置You can customize the appearance, content, browser support, editing support, graphics formats, screen resolution, file organization, and encoding of the HTML document by setting properties of the DefaultWebOptions 对象包含应用程序级的属性。The DefaultWebOptions object contains application-level properties. 任何具有相同名称的工作簿级属性设置(包含在 WebOptions 对象中)都优先于这些设置。These settings are overridden by any workbook-level property settings that have the same names (these are contained in the WebOptions object).

设置属性后,可以使用After setting the attributes, you can use the 以下示例设置各种应用程序级属性,然后设置活动工作簿的The following example sets various application-level properties and then sets the 最后,示例将区域保存为“C:\Reports\1998_Q1.htm”。Finally, the example saves the range as "C:\Reports\1998_Q1.htm."

With Application.DefaultWebOptions

.RelyonVML = True

.AllowPNG = True

.PixelsPerInch = 96

End With

With ActiveWorkbook

.WebOptions.AllowPNG = False

With .PublishObjects(1)

.FileName = "C:\Reports\1998_Q1.htm"

.Publish

End With

End With

还可以将文件直接保存到 Web 服务器。You can also save the files directly to a Web server. The following example saves a range to a Web server, giving the Web page the URL address https://example.homepage.com/annualreport.htm.

With ActiveWorkbook

With .WebOptions

.RelyonVML = True

.PixelsPerInch = 96

End With

With .PublishObjects(1)

.FileName = _

"https://example.homepage.com/annualreport.htm"

.Publish

End With

End With

在文档中打开 HTML Microsoft ExcelOpening an HTML Document in Microsoft Excel

若要在文档中编辑 HTML Excel,请首先使用 Open 方法To edit an HTML document in Excel, first open the document by using the 下面的示例打开文件"C:\Reports\1997_Q4.htm"进行编辑。The following example opens the file "C:\Reports\1997_Q4.htm" for editing.

Workbooks.Open Filename:="C:\Reports\1997_Q4.htm"

打开文件后,可以通过设置 DefaultWebOptions 和 WebOptions 对象的属性来自定义 HTML 文档的外观、内容、浏览器支持、编辑支持、图形格式、屏幕分辨率、文件组织和编码。After opening the file, you can customize the appearance, content, browser support, editing support, graphics formats, screen resolution, file organization, and encoding of the HTML document by setting properties of the DefaultWebOptions and WebOptions objects.

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值