Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Word Interop Codeblock. Working with Bookmarks/templates

Word Interop Codeblock. Working with Bookmarks/templates

Scheduled Pinned Locked Moved C#
csharpvisual-studiowpfcomhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joon vh
    wrote on last edited by
    #1

    I'm experimenting with opening a word document from a template and then changing some values. Have found some CP articles and other sources, but most of them are outdated (using interop 9 or 10 instead of 11). The problem lies here: ApplicationClass oWordApp = new ApplicationClass(); object missing = System.Reflection.Missing.Value; object oTemplate = "RappelTemplate.dot"; Document oWordDoc = oWordApp.Documents.Add( ref oTemplate, ref missing, ref missing, ref missing); object oBookMark = "bedrag"; **oWordDoc.Bookmarks[ref oBookMark].Range.Text = "100";** oWordDoc.Activate(); oWordApp.Visible = true; this line gives compile errors, because ref is an invalid expression term, and instead of oBookMark, "]" is expected. Nevertheless this is the only solution I can think of. It has to be ref, and it has to be oBookMark... Any hints?


    Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups