Click here to Skip to main content
15,868,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
 if (DropDownListDownloadCv0.Text == "DOC")
                    {

                        string sDirPath = Server.MapPath("~/PDF_WORD/Docs");

                        var ObjSearchDir = new DirectoryInfo(sDirPath);
                        if (!ObjSearchDir.Exists)
                        {
                            ObjSearchDir.Create();
                        }
                        string strFileName =
                            HttpContext.Current.Server.MapPath("~/PDF_WORD/Docs/Cv." + "DOC" +
                                                               "");
                        
                        var objfileinfo = new FileInfo(strFileName);
                        // step 1: creation of a document-object
                        Microsoft.Office.Interop.Word._Application w = new Microsoft.Office.Interop.Word.Application();
                        //var document = new Microsoft.Office.Interop.Word.Document();
                        object missing = System.Reflection.Missing.Value;

                        w.Visible = true;

                        _Document doc = w.Documents.Add(ref missing, ref missing, ref missing, ref missing);

                        Paragraph para1 = doc.Content.Paragraphs.Add(ref missing);
                        para1.Range.Text = LabelFirstName.Text;


                        
                    }
                
            }
            }

Where should i put objfileinfo?
var objfileinfo = new FileInfo(strFileName);
Posted
Comments
[no name] 24-Apr-13 7:11am    
"Where should i put objfileinfo?", where ever you want. You likely do not need it at all for whatever it is that you are trying to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900