简体   繁体   English

如何处理 OpenXML 中的浮动图像并转换为等效的 html

[英]How to handle floating images in OpenXML and convert to html equivalent

I am using OpenXML along with OpenXML Power Tools.我正在使用 OpenXML 和 OpenXML Power Tools。 So far I have managed to convert a lot of words functionality to html.到目前为止,我已经设法将很多单词功能转换为 html。 The main point I can't yet figure out is floating images.我还不能弄清楚的要点是浮动图像。 I have taken the following example from PowerTools and slightly modified it to my needs.我从 PowerTools 中获取了以下示例,并根据我的需要对其进行了稍微修改。 https://github.com/EricWhiteDev/Open-Xml-PowerTools/blob/1990e7f5bfd00a5e7aab2e074fa7fc0b1be7cd3a/OpenXmlPowerToolsExamples/HtmlConverter01/HtmlConverter01.cs https://github.com/EricWhiteDev/Open-Xml-PowerTools/blob/1990e7f5bfd00a5e7aab2e074fa7fc0b1be7cd3a/OpenXmlPowerToolsExamples/HtmlConverter01/HtmlConverter01.cs

The ImageHandler part is where I get stuck. ImageHandler 部分是我卡住的地方。 I can generate an image (and I've converted to base 64 so I don't have to worry about external images) but it always goes to the left (or follows manual tabbing), even though it's a floating image that goes horizontally in the middle with a slight gap at the top.我可以生成一个图像(并且我已经转换为 base 64,所以我不必担心外部图像)但它总是向左移动(或遵循手动选项卡),即使它是一个水平移动的浮动图像中部与顶部稍有间隙。

Has anyone any experience on how to achieve this?有没有人知道如何实现这一目标?

OpenXML Power Tools ignores all floating settings of images. OpenXML Power Tools 会忽略图像的所有浮动设置。

w:drawing with wp:inline and wp:anchor are handled the same way and result in the same html. w:drawing with wp:inlinewp:anchor以相同的方式处理并产生相同的 html。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM