Click here to Skip to main content
11,647,644 members (65,834 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Word
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 23-Apr-13 22:45pm
Kurac1866
Comments
ThePhantomUpvoter at 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)

  Print Answers RSS
0 jyo.net 500
1 F-ES Sitecore 370
2 OriginalGriff 322
3 DamithSL 315
4 CPallini 240
0 OriginalGriff 1,342
1 jyo.net 994
2 DamithSL 971
3 Sergey Alexandrovich Kryukov 873
4 CPallini 795


Advertise | Privacy | Mobile
Web01 | 2.8.150804.3 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100