Insert Text at Bookmark Position
Insert Text at Bookmark Position
CodePlex
HOME
Register
SOURCE CODE
DOWNLOADS
DOCUMENTATION
DISCUSSIONS
Sign In
ISSUES
PEOPLE
New
Thread
248907
Feb 24, 2014 at 7:49
AM
Edited Feb 24, 2014
at 7:51 AM
at the moment i am working with Replace, but its not a very good solution if there is a chance that someone manually likes to
change the document.
Here is my actual code:
LICENSE
Subscribe
Thank you
Reto
MadBoy
Developer
Some time ago bookmarks were added to main source code (not in the binary):
"This patch adds basic support for inserting and manipulating bookmarks inside a word file. It also allows for inserting text at
bookmark locations. The change was predicated on a need to insert text at bookmark locations in a sort of token replacement."
The code is below but this example is taken straight from Source Code where there are multiple examples for different things.
248907
Feb 24, 2014 at 8:53
https://docx.codeplex.com/discussions/534685[30/03/2015 21:59:04]
Yes i am looking for a solution to use a template i got and find the bookmark and insert text.
I was not able to find a paragraph or a bookmark after trying a few hours now.
Is there a solution to do it?
Hope you can help me.
Reto
What about iterate all paragraphs and look up for your specific bookmark?!
bjr001
Feb 25, 2014 at 2:28
PM
{
var bookmark = paragraph.GetBookmarks().FirstOrDefault(x => x.Name ==
"strDatum");
if (bookmark != null)
bookmark.Paragraph.InsertAtBookmark("24-02-2014", bookmark.Name);
}
248907
11:06 AM
Error 1 'Novacode.Paragraph' does not contain a definition for 'GetBookmarks' and no extension method 'GetBookmarks' accepting
a first argument of type 'Novacode.Paragraph' could be found (are you missing a using directive or an assembly reference?)
bjr001
WOW!, yes.
248907
Feb 27, 2014 at
12:10 PM
i DID download the newest compiled Version here 1.0.1.3 and the Thread you mentioned has the same Version but smaller and
newer.
Now it works.
Exactly what i needed. Thank you very very much!
Hi guys,
https://docx.codeplex.com/discussions/534685[30/03/2015 21:59:04]
misidra
Sep 11, 2014 at
10:45 AM
I'm trying to fill bookmarks of a Word document by the solution provided bjr001 but I have the following issue: GetBookmarks() is not
a member of Novacode.Paragraph.
Any solution possible?
Thanks in advance.
Hi misidra,
248907
Sep 11, 2014 at 1:37
PM
download the Version from the Thread mentioned by bjr001 and compile it yourself,
then use the .dll you compiled.
It worked for me, i hope it works for you too.
Let us know.
Greetings
Reto
misidra
I recently try to use that version, but now VS send me this error: Excepcin no controlada del tipo 'System.IO.FileNotFoundException'
en System.Windows.Forms.dll
Informacin adicional: Could not load file or assembly 'DocX, Version=1.0.1.13, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The system cannot find the file specified.
It doesn't work any function.
Hi misidra,
248907
Sep 11, 2014 at 3:29
PM
it says that the system is not able to find your dll. have you copied there from where you linked it in?
Or is the dll where it should be at runtime? where your .exe ist located?
saludos,
Reto
The .dll file is located at debug folder, like other resources that I'm using.
misidra
Sep 11, 2014 at 3:58
PM
248907
Sep 12, 2014 at 8:45
AM
misidra
Sep 12, 2014 at
Thanks anyway ;)
10:14 AM
@misindra if you're fine with Interop limitations and you know consequences of using it then it's fine. You've been warned :-)
MadBoy
Developer
I used NuGet to install DocX so shouldn't I have the latest version anyway? The link on the other thread didn't work and I don't have
the GetBookmarks() or any of the InsertBookmark, AppendBookmark etc code at all??
breath2k
Oct 13, 2014 at 1:20
PM
breath2k wrote:
MadBoy
Developer
I used NuGet to install DocX so shouldn't I have the latest version anyway? The link on the other thread didn't work and I don't
have the GetBookmarks() or any of the InsertBookmark, AppendBookmark etc code at all??
We don't support NuGet deployment as we don't have access there (not sure who is publishing there). So the version as NuGet
package may be a lot older then what you get by either downloading newest binary from here or compiling the source code. I would
suggest updating the version from binary that is downloadable from here. It was released recently.
2006-2015 Microsoft
Get Help
https://docx.codeplex.com/discussions/534685[30/03/2015 21:59:04]
Privacy Statement
Terms of Use
Code of Conduct
Advertise With Us
Version 12.4.2014.20959