Add to Word document with bullet-end formatting

I am working on a process that reads a Word document and adds some images to the end. The problem I'm running into is that the document ends up with a letter list and the images I add become part of that list. I can't seem to find a way to end this list before adding images.

Microsoft.Office.Interop.Word.Application winword =
    new Microsoft.Office.Interop.Word.Application();
winword.Visible = false;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document document = winword.Documents.Open(documentName);

object lastLine = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;
object lastDirection = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToLast;
document.Sections.Add(missing);
document.Sections[document.Sections.Count]
    .Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].LinkToPrevious = false;
document.Sections[document.Sections.Count]
    .Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "";

winword.Selection.GoTo(ref lastLine, ref lastDirection, ref missing, ref missing);
winword.Selection.EndKey(WdUnits.wdStory, missing);

foreach(string image in images)
{
    document.Application.Selection.InlineShapes.AddPicture(image);
}

document.SaveAs2("finished.doc",
                  Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument97);
document.Close();
winword.Quit();

      

+3
c # ms-word office-interop


source to share


No one has answered this question yet

Check out similar questions:

1804
How do you display code snippets in MS Word save format and syntax highlighting?
1424
How to fix "The breakpoint will not be removed at this time. No symbols have been loaded for this document." warning?
five
Reading the contents of a Word document (* .doc) using tables, etc.
2
How to access outline numbering in Word Document using C # and OpenXml?
0
Image is missing in text application using C #
0
Insert list <string> into text document
0
C #: insert and defer bullet points in a bookmark in a word document using Office Interop libraries
0
word interop replace tag with document content
0
Word Interop - Process headers and footers only once
-1
C # html to docx transform using Microsoft.Office.Interop



All Articles
Loading...
X
Show
Funny
Dev
Pics