This probably has a very simple answer, but I just can't find it.
I have a project using C # MVC 4 using Microsoft.Office.Interop.Word 12
In action, I try to dynamically create a Word file (using the database for information), and then I want to download it. The file does not exist (it was created from scratch), and I do not want to save it to disk (it does not need to be saved, because its contents are dynamic).
This is the code at the moment:
public ActionResult Generar(Documento documento) { Application word = new Application(); word.Visible = false; object miss = System.Reflection.Missing.Value; Document doc = word.Documents.Add(ref miss, ref miss, ref miss, ref miss); Paragraph par = doc.Content.Paragraphs.Add(ref miss); object style = "Heading 1"; par.Range.set_Style(ref style); par.Range.Text = "This is a dummy test"; byte[] bytes = null;
source share