如何使用powershell将excel 2007保存为html格式?
你好,我尝试使用该代码
$e = New-Object -ComObject "Excel.Application"
$e.Visible = $true
$ew = $e.Workbooks.Open("C:\Users\mich\14_50_33__5_Pt_50_sie_2011.xls")
$ew.SaveAs("C:\Users\mich\Documents\test", "Excel.XlFileFormat.xlHtml")
我做错了什么?
这是我自己的工作代码:
$xlExcelHTML = 44
$Excel = New-Object -ComObject "Excel.Application"
$Excel.Visible = $true
$WorkBook = $Excel.Workbooks.Open("C:\Users\mich\14_50_33__5_Pt_50_sie_2011")
$WorkSheet = $WorkBook.Worksheets.Item(1)
$WorkBook.SaveAs("C:\temp\test8",$xlExcelHTML)
这是格式扩展代码的链接: http://msdn.microsoft.com/en-us/library/bb241279(office.12).aspx
Hello i tried with that code
$e = New-Object -ComObject "Excel.Application"
$e.Visible = $true
$ew = $e.Workbooks.Open("C:\Users\mich\14_50_33__5_Pt_50_sie_2011.xls")
$ew.SaveAs("C:\Users\mich\Documents\test", "Excel.XlFileFormat.xlHtml")
What do i do wrong?
Here is my own working code:
$xlExcelHTML = 44
$Excel = New-Object -ComObject "Excel.Application"
$Excel.Visible = $true
$WorkBook = $Excel.Workbooks.Open("C:\Users\mich\14_50_33__5_Pt_50_sie_2011")
$WorkSheet = $WorkBook.Worksheets.Item(1)
$WorkBook.SaveAs("C:\temp\test8",$xlExcelHTML)
Here is a link for format extensions code: http://msdn.microsoft.com/en-us/library/bb241279(office.12).aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我有用。您需要将 12 个参数传递给 saveAs 方法。用 [type]::Missing 填充每个未指定的参数
This is working for me. There are 12 arguments you need to pass to the saveAs method. Fill each unspecified arguments with [type]::Missing