Html 使用MSO样式前缀格式化word页面
我需要预先格式化一个MS页面。特别是字体,以便与网站保持一致。 MS似乎至少忽略了字体系列MSO样式集 我已经试过Html 使用MSO样式前缀格式化word页面,html,css,ms-word,asp-classic,Html,Css,Ms Word,Asp Classic,我需要预先格式化一个MS页面。特别是字体,以便与网站保持一致。 MS似乎至少忽略了字体系列MSO样式集 我已经试过!重要信息,将word文档保存为网页,编辑样式并使用我试图在word页面上格式化的原始HTML文件中的样式 我的代码: <style> h1 { font-family:'Trebuchet MS', Arial, sans-serif!important; mso-fareast-font-family:"Trebuchet MS"!important;
!重要信息
,将word文档保存为网页,编辑样式并使用我试图在word页面上格式化的原始HTML文件中的样式
我的代码:
<style>
h1 {
font-family:'Trebuchet MS', Arial, sans-serif!important;
mso-fareast-font-family:"Trebuchet MS"!important;
}
p {
font-family:"Arial",Helvetica,sans-serif!important;
mso-fareast-font-family:"Arial"!important;
}
</style>
<%
Dim file
file = "saveddocument.doc"
With Response
.Buffer = True
.ContentType = "application/msword"
.AddHeader "content-disposition", "inline; filename=" & file
.Write "<h1>This text should be formatted as Trebuchet MS</h1>" _
& "<p> This text should be formatted as Arial</p>"
.Flush
.End
End With
%>
h1{
字体系列:'Trebuchet MS',Arial,无衬线字体!重要;
mso fareast字体系列:“投石机MS”!重要;
}
p{
字体系列:“Arial”,Helvetica,无衬线字体!重要;
mso远东字体系列:“Arial”!重要;
}
预期成果:
打开MS Word时,h1
标题应使用字体设置样式
投石机MS和带有Arial的p
标签
当前结果:
不遵守《新罗马时报》
我错过了什么?非常感谢您的帮助。我的答案如下:
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment;filename=HelpFile.doc"
Response.write("<html " & _
"xmlns:o='urn:schemas-microsoft-com:office:office' " & _
"xmlns:w='urn:schemas-microsoft-com:office:word'" & _
"xmlns='https://www.w3.org/TR/html401/'>")
Response.ContentType=“应用程序/msword”
Response.AddHeader“内容处置”、“附件;文件名=HelpFile.doc”
回答。写(“”)
我的代码中缺少xmlns
代码,因此无法读取css
将其添加到文档中可确保其可读性并修复我的字体格式问题。我希望这个答案能帮助其他类似情况的人