locked
How to draw a line in MS word using c#.net RRS feed

  • Question

  • User-1949221332 posted

    Hi All,

    I want to incorporate an issue that i want to draw a line in MS word using c#.net. but i did not find any solution. so can any body  help me. i am using "Microsoft.Office.Interop.Word" Library.

    Your quick response will be highly appreciated.

    Regards,

    Ali bin zubair


    Thursday, August 6, 2009 5:49 AM

Answers

  • User-1949221332 posted

    Hi All,

    I want to incorporate an issue that i want to draw a line in MS word using c#.net. but i did not find any solution. so can any body  help me. i am using "Microsoft.Office.Interop.Word" Library.

    Your quick response will be highly appreciated.

    Regards,

    Ali bin zubair



    Oh yes just got the solution.....From nikho

    Look at the Shapes.Addline method.

    Something like:

          // show word
    Word._Application wordApp = new Word.Application();
    wordApp.Visible = true;

    // add doc
    Word._Document wordDoc = wordApp.Documents.Add(ref Missing, ref Missing, ref Missing, ref Missing);

    // draw line
    wordDoc.Shapes.AddLine(10f,10f, 500f, 10f, ref Missing);

    Regards

    Ali bin zubair
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 7, 2009 2:12 AM

All replies

  • User840129657 posted


    hi,

    try this

    http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.inlineshape.line(office.11).aspx

    http://support.microsoft.com/kb/316384

    http://www.codeproject.com/KB/aspnet/wordapplication.aspx?fid=15166&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=151&select=828371

    http://www.neodynamic.com/ND/FaqsTipsTricks.aspx?tabid=66&prodid=3&sid=36

    Thursday, August 6, 2009 6:59 AM
  • User-1949221332 posted

    Hi All,

    I want to incorporate an issue that i want to draw a line in MS word using c#.net. but i did not find any solution. so can any body  help me. i am using "Microsoft.Office.Interop.Word" Library.

    Your quick response will be highly appreciated.

    Regards,

    Ali bin zubair



    Oh yes just got the solution.....From nikho

    Look at the Shapes.Addline method.

    Something like:

          // show word
    Word._Application wordApp = new Word.Application();
    wordApp.Visible = true;

    // add doc
    Word._Document wordDoc = wordApp.Documents.Add(ref Missing, ref Missing, ref Missing, ref Missing);

    // draw line
    wordDoc.Shapes.AddLine(10f,10f, 500f, 10f, ref Missing);

    Regards

    Ali bin zubair
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 7, 2009 2:12 AM