Aspose Words Builder InsertHTML not inserting correctly

I am using Aspose.Words 10.4.0.0.

When I insert the html, it is inserting before the bookmark rather than after and then adding a line after the bookmark.

I don't want any spaces at all.

Here is my code:

Aspose.Words.License license = new Aspose.Words.License();

license.SetLicense(@"c:\testing\Aspose.Total.lic");

string sHTML = "

kVA 300 kVA 3 Phase Pad-Mounted Transformer
Temperature Rise 65 degree average winding rise
Cooling Class ONAN
Insulating fluid Mineral Oil
Efficiency Standard None
Harmonic 'K' Factor None
Primary Voltage 12470GY/7200
BIL 95 kV
kV Class 15 kV
Primary Configuration Dead Front
Primary Configuration Radial Feed
Taps No Taps
Primary Bushings 200 amp Cooper bushing well(s) (Qty: 3)
Inserts 15 kV, 95 kV BIL Cooper load-break inserts (Qty: 3)
Overcurrent Protection Bayonet fuse in series with Partial-Range Current-Limiting Fuses (Qty: 3)
Expulsion fuses Bayonet fuses (Qty: 3)
Bayonet Holder Copper Bayonet Fuse Holder (Qty: 3)
Secondary Voltage 480Y/277
BIL 30 kV
Secondary kV Class 1.2 kV
Secondary Bushings 5/8' copper stud with 4-hole screw-on spade bushing(s) (Qty: 4)
Cabinet hardware Penta-head cabinet door bolts
ANSI K-Dimension Radial feed per ANSI C57.12.34 Figure 1 minimum dimensions
Coatings Munsell Green (Munsell 7GY 3.29/1.5) topcoat
Gauges & Fittings Drain plug in LV Compartment
Gauges & Fittings Pressure relief device, 35 SCFM
Tank accessories IEEE standard one-hole ground pads (Qty: 3)
Packaging Pallet
Cover Bolted cover
";

Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\testing\template1.doc");

Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);

builder.MoveToBookmark("ScopeOfSupply",true,true);

builder.InsertHtml(sHTML);

builder.MoveToBookmark("ScopeOfSupply");

doc.Save(@"c:\testing\newdoc.doc");

Hi there,


Thanks for your inquiry.

You may want to try using the second overload of the MoveToBookmark method which accepts extra parameters to further control where the cursor is moved to in relation to the bookmark. Please see the page here for details: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.documentbuilder.movetobookmark_overload_2.html

Regarding the extra space, I suppose this is just the original paragraph with the bookmark remaining in the document. You may wish to remove this using the follow code.

<span style=“font-size:10.0pt;line-height:115%;font-family:
“Courier New”;mso-no-proof:yes”>doc.Range.Bookmarks[“ScopeOfSupply”].BookmarkStart.ParentNode.Remove();


If we can help with anything else, please feel free to ask.

Thanks,

Removing the bookmark described above fixed this problem.

Thanks for the quick response!