html2openxml icon indicating copy to clipboard operation
html2openxml copied to clipboard

Ca't open generated dcument with image

Open anatoly-kryzhanovsky opened this issue 5 years ago • 1 comments

good day i have some trouble and need assist i have test html markup:

<h2>Sample</h2>
<p><span class=""text-big"" style=""font-family:'Courier New', Courier, monospace; "">row </span><span class=""text-tiny"">with </span><span class=""text-big"" style=""color: hsl(60, 75 %, 60 %); "">different </span><span class=""text-big"">text </span><span class=""text-big"" style=""background-color:hsl(120, 75 %, 60 %); "">formats</span></p>
<p>This is an instance of the <a href=""https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor"">classic editor build</a>.</p>
<figure class=""image""><img src=""https://image.shutterstock.com/image-photo/beautiful-water-drop-on-dandelion-260nw-789676552.jpg"" alt=""Autumn fields""></figure>
<p>You can use this sample to validate whether your <a href=""https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html"">custom build</a> works fine.</p>

i try to insert converted paragrahs to my document:

var converter = new HtmlConverter(document.MainDocumentPart);
converter.ImageProcessing = ImageProcessing.AutomaticDownload;
var parsedData = converter.Parse(content);
foreach (var itm in parsedData)
	position.AppendChild(itm);

but then i try to open document with wrd (2016) i receive error:unspecified error: part: /word/document.xml, Line: 0, Column: 0

i try to skip paragraph with image and document open correctly. i also look at document.xml inside docx and where is no other difference for document with image and without it...

<p> 
	<r>
		<drawing>
			<inline distT="0" distB="0" distL="0" distR="0">
				<extent cx="3962399" cy="2667000" />
				<effectExtent l="19050" t="0" r="0" b="0" />
				<docPr id="5" name="https://image.shutterstock.com/image-photo/beautiful-water-drop-on-dandelion-260nw-789676552.jpg" descr="" />
				<cNvGraphicFramePr>
					<graphicFrameLocks noChangeAspect="1" />
				</cNvGraphicFramePr>
				<graphic>
					<graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
						<pic>
			        			<nvPicPr>
								<cNvPr id="2" name="https://image.shutterstock.com/image-photo/beautiful-water-drop-on-dandelion-260nw-789676552.jpg" descr="Autumn fields" />
								<cNvPicPr>
									<picLocks noChangeAspect="1" noChangeArrowheads="1" />
								</cNvPicPr>
							</nvPicPr>
				        		<blipFill>
								<blip r:embed="R44d8b6de1eae414a" />
								<srcRect />
								<stretch>
									<fillRect />
								</stretch>
							</blipFill>
							<spPr bwMode="auto">
								<xfrm>
									<off x="0" y="0" />
									<ext cx="3962399" cy="2667000" />
								</xfrm>
								<prstGeom prst="rect">
									<avLst />
								</prstGeom>
							</spPr>
						</pic>
					</graphicData>
				</graphic>
			</inline>
		</drawing>
	</r>
</p>

html2openxml version: 2.0.3 platform: .net core 2.1

anatoly-kryzhanovsky avatar Sep 13 '19 05:09 anatoly-kryzhanovsky

small update about my issue... i try to investigate problem and found this things:

  1. i have text drawing after part where content was inserted. after i removed this drawing all works fine - document generated and opened correctly... even more - i readd this part and all still works!
  2. after that i try to insert content twise - and again same problem.. this is so strange.

anatoly-kryzhanovsky avatar Sep 18 '19 05:09 anatoly-kryzhanovsky