none
insert a Baclground picture into a word document using c#? RRS feed

Answers

  • Hi Venkatesan

    I understand that you want to send a form to people that they can print out themselves.

    But have you actually sat down in Word and tried to set this up, the way an end-user would? Coding in Word essentially mirrors what an end-user does. If you don't understand the mechanics required as an end-user, you'll be frustrated no end as a programmer... Placing data in a Word document that should match up directly over a picture is not a trivial undertaking. And what's difficult to do in the UI is usually much more difficult to achieve programmatically - and I know from experience that what I understand you to want is not simple to realize.

    It would make much more sense to me for you to set up a document with all the basics, then make copies of that, where you write the data. All your code would need to do is write the data, nothing else.

    What's more, since the form you show me is relatively simple, it would probably be better to take the time to create the form in Word, probably using Tables, rather than rely on positioning in multiple layers over an image.

    Given that this appears to be a servr-side type of application, I also recommend looking at leveraging the Open XML file format to write the data. (Possibly using the Open XML SDK)


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, May 3, 2013 3:15 PM
    Moderator

All replies

  • We need more information

    Version of Word?

    More specific information about what is meant by a "background picture": Do you mean a picture visible on every page of the document, or only on one specific page? Should the picture always remain in the same position on a page or move as the text moves when it's edited?

    Anything else special about the picture?

    It would help us help you if you could also list the steps you take to create the "background picture" as a user in the Word application. You might also try recording a macro when doing so in order to generate the basic object model syntax to use as a starting point.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, April 26, 2013 7:02 AM
    Moderator
  • We need more information

    Version of Word?

    More specific information about what is meant by a "background picture": Do you mean a picture visible on every page of the document, or only on one specific page? Should the picture always remain in the same position on a page or move as the text moves when it's edited?

    Anything else special about the picture?

    It would help us help you if you could also list the steps you take to create the "background picture" as a user in the Word application. You might also try recording a macro when doing so in order to generate the basic object model syntax to use as a starting point.


    Cindy Meister, VSTO/Word MVP, my blog

    Hi Thank you for your replay .I need to set single background image for all document pages and it shoud be visable to the user ..PLease below take as example Cutomer informations(john,etc..) will coming from program .

    


    A.Venkatesan



    Friday, April 26, 2013 7:18 AM
  • Hi Venkatesan

    I think I'm even more confused now that I was originally... And you still haven't specified the version of Word involved...

    Are you saying you want to put this image of a paper form "behind" the document text? Is the idea that people should be able to fill out the form while working in Word? And what should the print-out result be?

    Why would you not create the entire form in Word, to begin with?


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, April 28, 2013 6:05 AM
    Moderator
  • Hi Cindy Meister,

    Sorry for delay .

    Thank for your reply sir .AS of Now we are currently have program to give output data  only  then we will export into word doc and print in a paper send to the clients.we don't want to print the data in paper because daily we have to print 300 to 400 paper print. So if i have same paper format(with image) in my output(on export) with data then we will only fax it will reduce our time and money lot.I am using word 2007,VS2010 C#.


    A.Venkatesan


    Monday, April 29, 2013 2:28 PM
  • Hi Venkatesan

    I understand that you want to send a form to people that they can print out themselves.

    But have you actually sat down in Word and tried to set this up, the way an end-user would? Coding in Word essentially mirrors what an end-user does. If you don't understand the mechanics required as an end-user, you'll be frustrated no end as a programmer... Placing data in a Word document that should match up directly over a picture is not a trivial undertaking. And what's difficult to do in the UI is usually much more difficult to achieve programmatically - and I know from experience that what I understand you to want is not simple to realize.

    It would make much more sense to me for you to set up a document with all the basics, then make copies of that, where you write the data. All your code would need to do is write the data, nothing else.

    What's more, since the form you show me is relatively simple, it would probably be better to take the time to create the form in Word, probably using Tables, rather than rely on positioning in multiple layers over an image.

    Given that this appears to be a servr-side type of application, I also recommend looking at leveraging the Open XML file format to write the data. (Possibly using the Open XML SDK)


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, May 3, 2013 3:15 PM
    Moderator