How to insert a footnote into word using c#
I am currently using Microsoft.Office.Interop.Word.Application for a c# desktop application project and I need to insert footnotes in my document automatically using开发者_高级运维 c#. I have searched many different places but have not found a solution which works for me.
I am using visual studio 2010, c#, word 2007, WPF
Thanks.
EDIT: Solutions I have tried:
-http://msdn.microsoft.com/en-us/library/bb211955%28v=office.12%29.aspx (This is visual basic)
-Solutions that include xml
I need solutions that are C# and C# only
Document doc = app.ActiveDocument;
object selStart = 12;
object selEnd = 14;
object missing = Type.Missing;
object footnote = "This is a footnote";
Range range = doc.Range(ref selStart, ref selEnd);
doc.Footnotes.Add(range, ref missing, footnote);
I haven't tested it, but that would be a rough outline of how to do it.
You can use OpenXML SDK. You can generate/modify word, excel and powerpoint files from pure C# code without the need of interop and office installed on the server (in case of a web app).
精彩评论