忽略所有父css的Html元素

问题描述 投票:0回答:2

我在我的网站中嵌入了一个word文档保存为html,但生成的css和我的网站之间存在冲突。真正帮助我的是拥有一个“范围”元素,它不会影响或受到网站本身的影响。有没有解决这个问题的方法?谢谢

html css html5 aspose.words
2个回答
0
投票

我个人使用类作为范围的包装器。在word文档的所有样式下面将“范围”到span标记的开头和结尾。

/*some css wrapper class*/
.word-document-wrapper
{

}
<span class="word-document-wrapper>

  <!--word document here-->

</span>

0
投票

将Word文档保存为Html,Mhtml或Epub格式时,可以使用HtmlSaveOptions类指定其他选项。例如:

Document doc = new Document("D:\\Temp\\input.docx");

HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);
opts.CssStyleSheetType = CssStyleSheetType.Embedded;
opts.ExportImagesAsBase64 = true;
opts.ExportFontsAsBase64 = true;
opts.PrettyFormat = true;

doc.Save("D:\\temp\\18.8.html", opts);

我和Aspose一起担任开发者布道者。

© www.soinside.com 2019 - 2024. All rights reserved.