Is it possible to create shapes in a Word document using C#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Dransfield
    New Member
    • Jan 2011
    • 46

    Is it possible to create shapes in a Word document using C#?

    I'm attempting to create shapes on a Microsoft Office Word document to model the layout of tables in a room. I've found a nice article (http://support.microsoft.com/kb/316384) that demonstrates how to create tables and text, but it doesn't mention anything about shapes. Is this possible or am I just dreaming?
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    It looks like a document object has a Shapes property that will let you call an AddShape method.



    AddShape takes a type, then 4 integers that define a rectangle. For the type, it looks like you use the following:



    Hopefully that helps you :)

    Comment

    • Alex Dransfield
      New Member
      • Jan 2011
      • 46

      #3
      Is there anything that you don't know?

      Luckily I managed to find out about this before I read your reply, but I'm now having a problem with formatting (color, border size). Could you point me in the right direction for this? My shapes have a dark blue centre with an even darker border at the moment, which seems to be my default in Word.

      I'll have to credit you in my project for sure Gary :)

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        I can't take credit for that one ;) I googled around and found the information, them compiled the links. But hey, no problem! :D

        Haha, I'd imagine you did the same steps I did. Glad you got it figured out though! If there's anything else I can help with, please let me know. I've never done this either so I'm googling/experimenting along with you, but sometimes two heads are better than one.

        Comment

        Working...