Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用MSO样式前缀格式化word页面_Html_Css_Ms Word_Asp Classic - Fatal编程技术网

Html 使用MSO样式前缀格式化word页面

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;

我需要预先格式化一个MS页面。特别是字体,以便与网站保持一致。 MS似乎至少忽略了字体系列MSO样式集

我已经试过
!重要信息
,将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

将其添加到文档中可确保其可读性并修复我的字体格式问题。我希望这个答案能帮助其他类似情况的人