简而言之:我想从 htmlstring 创建一个 word 文档,并且 html 包含嵌入的 base64 图像。
我的问题: 我已经设法使用 Altchunk 创建了 word 文档,但是当我打开文档时,图像应该在的位置不显示图像,而是显示消息:
无法显示链接的图像。该文件可能已被移动、重命名或删除。验证链接是否指向正确的文件和位置。
我的代码:
string base64Image = @"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATsAAABbCAYAAAAMXyIpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAACoVSURBVHhe7Z13dF3Ftcbff6+/lZW38l54byV5AUKHQEILEBISSIBQAqG3QIBQQugdGzDYgHHvuGFsY1uWewUbN1nuVbZkSZZkq1rV6r3cs9/5je6I0dG50tW1bMu68601S1dXc+ZM2fubvffsc/QPYmFhYREFsGRnYWERFbBkZ2FhERWwZGdhYREViA6ya6oTKUoT2TNHnK8GuD/nilQVBf9oYWERDejbZJexUZy40eIseV2cOU+IM/a34gy9TGTpmyL5+4OVLCwsogF9muycTRPEmXiLOB+dJ84HZ4jzzn+L8/b3RGY8KJK2LljLwsIiGtC3yW7DKHFGXq0Irl1xCVC5shYWFlGDvk12e+eJM+m2jmQ34iqXCEcGa1lYWEQD+nbM7vBmcWY91pHsPrlInJXvBitZWFhEA04NsqvMESlOFGmqcc01J/hlGChKFZn/fEeyG3C6OLHPijTWdq89CwuLUxa9l+ycgEhDhUjmanHi3xNn3WsiWWtEmuuDFcIA6SWuBef0/9/2ZNfvNHG+uE+kPFck0BKsbGFh0ZfRO8muuU6kLF2c5LniLLpHAuN+KIHxPxLn66ddKy/bJaimYMUuADHGjRJn4NntyY7y2U0ueW5z6zQGK1tYWPRl9D6yc1xLq/Sga80NkMCE0yUw9N8k8Ok/tpYxp4mkxIrUlQQrh4GdM8UZfmVHsht9rciemFZX1sLCos+j95FdbZE4eydJYOT3JDDkX1yS+6dvyQ7im3apOLnxwcpdw9m/SFlxHchu2BUq4VgaqoM1LSws+jJ6H9m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LVlbiBtLMJw3EninuiLOQayD/ziwBrIDZ4A/dDXsHHhHenk5Uhgyc4FFh6TiBVBMJvTO1xbcoogDOI+PC9LXhIWCoKBsGCqs5v6ASuJAD6WBURAm7hUZg4TbiALi1AjFFgyCAL3xAriaQXeLEycAsUn/kVckcAv/QgVqKVfEBDXkPSMkmEx0i4FCw9XAbfWbxzs9pyWIvwc85vvIvMD12LN8NYRrmGeGKd+a4UGFhRWI0nbxD1xgxgnfWLcEA3xOdaB9TDjnJ2BeeQAhza5PwXrllgasalQa+QFawZR4Crp9aCPyIG5HoQ5CGuwvpCb2T6fmXtCErxiSveHz5C9N1ewM+B+Mx+6DYpXhvzAfHAfrHWeLyXFBPnjetaVF2GaREWfGTubHlYeMT3WAplH9pEdCI4XZkByyKx33KHAZoMMmmMg/owchAJ9Y+1YQ30NsUjkOVRcOxyERXYWFhYWpzos2VlYWEQFLNlZWFhEBSzZWVhYRAUs2VlYWEQFLNlZWFhEBSzZWVhYRAUs2VlYWEQFLNlZWFhEBSzZWVhYRAUs2VlYWEQBRP4ftd9HFPdusAIAAAAASUVORK5CYII=";
string htmlString = string.Format(@"<html>
<head/>
<body>
<h1>AltChunk HTML with base64 Image</h1>
<p>This is an html document with a base64 image</p>
<img filename='test.jpg' alt='' src='{0}' />
<h1>Results in:</h1>
<p>The linked image cannot be displayed. The file may have been moved,renamed, or deleted. Verify that the link points to the correct file and location.</p>
</body>
</html>", base64Image);
string fileName = @"c:\temp\newdocx.docx";
using (WordprocessingDocument wordDoc = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))
{
// Set the content of the document so that Word can open it.
MainDocumentPart mainPart = wordDoc.AddMainDocumentPart();
mainPart.Document = new Document();
Document document = mainPart.Document;
Body body = document.AppendChild(new Body());
// create AltChunk
string altChunkId = "AltChunkId1";
AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart(
AlternativeFormatImportPartType.Html,
altChunkId);
// add the html to the chunk!
using (Stream chunkStream = chunk.GetStream(FileMode.Create, FileAccess.Write))
{
using (StreamWriter stringWriter = new StreamWriter(chunkStream, Encoding.UTF8)) //Encoding.UTF8 is important to remove special characters
{
stringWriter.Write(htmlString);
}
}
AltChunk altChunk = new AltChunk();
altChunk.Id = altChunkId;
body.AppendChild(altChunk);
mainPart.Document.Save();
}
问题截图: 问题
我真的很感谢这个案例的一些帮助,已经被困在这个问题上超过 2 天,搜索了整个互联网我猜 :),但我发现没有任何东西可以帮助我。