Oki, so i got it working now, thanks to Qsebas for the breakthrough with his last edit. I'm using vs2005 with .net framework 2.0, so i had to modify it a bit, so i'm giving the credits to you Qsebas.
If anyone is interested, this is what i ended up with.
using Word = Microsoft.Office.Interop.Word;
public class user
{
public string Convert(string input, string output)
{
object oMissing = System.Reflection.Missing.Value;
object readOnly = false;
object oInput = input;
object oOutput = output;
object oFormat = Word.WdSaveFormat.wdFormatFilteredHTML;
object html_start = "HTML_SECTION_START";
object html_end = "HTML_SECTION_END";
object move = -1;
object charUnit = Word.WdUnits.wdCharacter;
Word._Application app = new Word.Application();
try
{
Word._Document doc = app.Documents.Open(ref oInput, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref isVisible, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
try
{
Word.Range dRange = doc.Range(ref oMissing, ref oMissing);
dRange.Start = doc.Bookmarks.get_Item(ref html_start).Range.End;
dRange.End = doc.Bookmarks.get_Item(ref html_end).Range.Start;
dRange.Delete(ref charUnit, ref move);
doc.Save();
app.Quit(ref oMissing, ref oMissing, ref oMissing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
return "";
}
catch (Exception e)
{
app.Quit(ref oMissing, ref oMissing, ref oMissing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
return e.ToString();
}
}
catch (Exception e)
{
app.Quit(ref oMissing, ref oMissing, ref oMissing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
return e.ToString();
}
}
}