.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Inserting a document ID into a word document

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :SharePoint

Hi all,

I would like to have the document ID embedded in the footer of word documents automatically.  Once a document is created I can insert the value (Insert | document properties | Document ID : Value) without a problem.

What I would like is to do this in the document template, but the Document ID: Value isnt available (as I guess its not been created yet).  I could use a workflow to update the document after creation but I wondered if anyone has a smarter way of acheiving this?






View Complete Post

More Related Resource Links

Charset Problem with dynamically generated Word Document


in my asp.net web application i am dynamically generating a word documnet out of a sql data. I have set the char set UTF-8 during the doument creation in code but still when i open the generated document and check it char set .. it is always windows-1252 not the one that i have set. My sql data in the document have special characters whihc can only be understandable using the UTF-8 charset otherwise its always ?T written in place of an apostrophy . Pasting my code here..

         HttpContext.Current.Response.ContentType = "application/msword";
         HttpContext.Current.Response.ContentEncoding = System.Text.UnicodeEncoding.UTF8;
         HttpContext.Current.Response.Charset = "utf-8";
         string strFileName = "Details" + ".doc";
        HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName);
        StringBuilder strHTMLContent = new StringBuilder();
        string strMessage = " ";
        DataView abstractview = (DataView)dsAbstract.Select(DataSourceSelectArguments.Empty);
        foreach (DataRowView row1 in abstractview)
            strMessage += "<table border='1' cellspacing='0' cellpadding='5' width

Embed word document inside excel



I am using ASP.NET and C# 2.0 and working on web application.

I want to embed a word document inside a excel sheet.

How to embed word document inside excel.

Thank you



Advanced Basics: Setting Word Document Properties the Office 2007 Way


The last time I wrote this column (March 2006), I shared an application that allows you to update all the Microsoft® Word documents in a folder and its subfolders. Each time the application finds a document in the specified path, it updates the document properties to match those you specified in the application.

Ken Getz

MSDN Magazine June 2006

Advanced Basics: Set Word Document Properties Programmatically


At the beginning of another lovely day of writing courseware in mad pursuit of unrealistic deadlines, I received a frantic call from a business partner. He was at the end of a long consulting project and had several hundred Microsoft® Word documents, all of which required their document properties to be set identically, except the Title property of the document, which was to be based on the document file name, minus the .

Ken Getz

MSDN Magazine March 2006

Full text search in a Word document



  I´m currently programming a web search application in ASP.Net and having problem with full text searching. My requirements are:

1. Save a byte array from SQL server to word document as a temp file in a server side?

2. How to highlight the string I am currently searching in the Word document and return to the user the sentence with the highlighted string (like on Bing or any other search engines)? Is it possible to fullfill this requirement with full-text search integrated in SQL Server 2008?

Thanks in advance,




Re-authentication issue when openeing a MS Word Document


We have a SharePoint installation for one of our clients with external access enabled using https via ISA server. When accessing the portal internally within the intranet/domain its fine. In case of external access using https when users login to portal adn when they try to open a MS Word (or any Office) document they are prompted to to enter their username and password again. It happens for every MS Office document. We are using MOSS 2007, Office 2007. I know that the promp for re-authentication is is due to the fact that office try to open a new session but is there any work around to overcome this.

Any help will be highly appreciated.



Search does not find text in Word document stored in document library on a Report Center site within



We have a document library on a site created off of the Report Center site template. We uploaded a Word 2007 document with the word zebra in the text. Using the search bar at the top of the page we selected This list: Our document library and searched for zebra. We received no results.

We tested the same thing on another site (site template Team site) within the same site collection and search worked fine.

Does the Report Center search function differently then the search functionality on the Team site?

Tamara Bredemus SharePoint Minion...working up to Maven

Replace text in a word document stored in a Document Library


Hi to all,

im tying to replace some text introduced in a word document stored in a document library.

Exactly i need a web part with a button that change a key in a word template <list> (for example) and replace <list> with a text in another list.


I think that it would works with the Microsoft.Office.Word.Interop; namespace but when i call the function :

wDoc = wordApp.Documents.Open(ref fileName, ref missing,
                                ref readOnly, ref missing, ref missing, ref missing,
                                ref missing, ref missing, ref missing, ref missing,
                                ref missing, ref isVisible, ref missing, ref missing,

merge word document



I recently created a team site on the SharePoint for projects management and our team will use the word document for inserting the information about the project that they work on it,

My case is:

for each project have multiple documents and i created a user control by VS.2005, this user control contain a drop down list contain all projects and merge button, when the user choose any project and click merge i will use the Work dll to merge all document that related to the project and export to the user.

This is my code

private void mergeDocument()


ApplicationClass WordApp =

open Word document in iframe without open/ save dialouge

Hello All! In my application users upload their word document and user has been given an option to preivew the uploaded document. Inorder to  preview  the document  i put the following code in my page_load eventdiv1.InnerHtml = "<iframe name='iframe4' src='DocumentUuploaded/report.doc ' target='iframe4'  frameborder='no' height='500' scrolling='no' width='800'></iframe>";The problem is it is asking Do you want to open or save this file. How can i get rid of this dialouge box . Pls helpThanks in advance.

Replace Text in textbox in word document using interop and asp.net

Hi all,  I'm trying to create a function to replace fields in a word document using asp.net. The fields are marked in the document using ###field### and I need to replace them with the data from the DB. The code I have works fine for the body of the word document but doesn't appear to work if the text is contained within a textbox, is there a way to correct this? Here's the code I am currently using Dim Contract as string Dim word As New Word.Application        Dim doc As Word.Document        Try            word.Documents.Open("c:\FYI.doc")            word.Visible = True             doc = word.ActiveDocument            Dim myStoryRange As Microsoft.Office.Interop.Word.Range            For Each myStoryRange In doc.StoryRanges                With myStoryRange.Find                    .Text = "###field###&quo

Display the content of a Word document in a web part?

Hello all,We are planning to display the content of the word document pulling document from document library in a web page in sharepoint as a web part.So, based on above requirement , I have to display word document in a container/control which allows word document to edit, read and save it back to document library.I know that if you have Office 2007 installed we can convert the word document to web page and display it in the page viewer web part but we have office 2003 suite. So we are looking for web part which can display the content of the word document inline with the web page.Thanks in advacne,Chakri

Is there a way to parse information in a word document and store them on a list (MOSS2007)? (Without

My current project requires me to parse through a Word document with tables that simulate a form. However Infopath isn't an available rescource for me. For example I'm to bring all information in the notes cell onto a list in sharepoint. Ultimately i'll be using a view to display that list through a webpart on a dashboard like interface on a sharepoint page. Is this possible? or is Info Path really the only way to go about this?

how to embedd a word document into web page

Hi All, I want to show a new word file opened in a panel/div/frame on web page. Can anybody help me in doing that. I have tried with Iframe but when page loads completely it opens as open save dialog but I want it to be opened on web page. Please help. 

Converting Word Documents library to PDF document library in SharePoint Server 2007

My project requires me to create an event reciever such that when a word file is added to one library the same content pdf file should be added to other library also when a word file is updated,edited or checked in the respective pdf file in other document library should be replaced by a new pdf file with the edited word content . Can we do this in Sharepoint 2007 I have seen this can be done in Sharepoint 2010 http://msdn.microsoft.com/en-us/library/ff181518.aspx

How to save word document in sql database?

Hi all, I have created a word document in my application (.Net). How can I save the word document (containing tables and some HTML formats) in a database and retrieve it for later use? Thank you in advance,

SharePoint 2010 Office Web Apps "Word Web App cannot open this document for viewing because of an un

<label id="message" class="WACStandardDialogLabel">I have provisioned a SharePoint 2010 Server (RTM: 14.0.4762.1000)  with Office Web Apps.</label> <label class="WACStandardDialogLabel">It is a single server with a separate SQl 2008 Standard server.</label> <label class="WACStandardDialogLabel">I have seen that there were some issues in site that were configured with a port.  The Web Application I am having issues with is running on a port  and is extended on 443 as well.</label> <label class="WACStandardDialogLabel">I can view PPTX but Word docx files can't be viewed.  The word docx files howerver can be edited in the browser.</label> <label class="WACStandardDialogLabel">I get the following error when I try to view a word file in the browser:</label> <label class="WACStandardDialogLabel"></label> "Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word. Error Id: 7f644fec-c2d7-4387-b280-31a4647afea1, 20100509213834 " I am seeing an error in the event log that identifies the Application Service account (that includes the Word Viewer Service) can't access the portal site collection database.  -I am using the appl
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend