Quantcast
Channel: Word for Developers forum
Viewing all 4350 articles
Browse latest View live

How do I open an existing document in VB and change the MainDocumentType to wdCatalog?

$
0
0

I have a VB application that automates mail merges and it works fine as long as they are form letter merges.  But if I try to change the MainDocumentType to wdCatalog:

doc.MailMerge.MainDocumentType = Word.WdMailMergeMainDocType.wdCatalog

Then the merge doesn't happen...no error.  If I run the debugger, I can see that after the above statement is executed, the value of the property is displayed in red...but no hint what it is objecting to. 

The examples I find, all show creating a new document, and I am using an existing document...is there something I need to do differently with an existing document?


Why Does Winword Macro Fail to Properly Update Fields in Footnotes the First Time it Runs, But is Okay the Second Time?

$
0
0

I’m working on a Word document with around 140,000 words, 380 pages, and 170 footnotes. The document has cross-reference fields (displaying page numbers) in both the body and the footnotes.

First thing every morning I run a Word macro that is supposed to (a) update fields in the body, (b) update fields in the footnotes, and (c) perform a few other housekeeping tasks. This macro ran correctly in Word 2010 under Windows 7. However, the macro fails to properly update the fields in the footnotes under up-to-date (non-Insider, subscription) Word 2016 under up-to-date Windows 10 Professional.

The macro attempts to update the fields in the footnotes because it displays the message “Word can’t undo this action. Do you want to continue?”, which it displays if I manually highlight all the footnotes and select Update Fields. But when I click Yes, the macro adjusts the fields, but the page numbers in the footnote fields are too low, and I see that the page count in the status bar at the bottom of the screen is also too low, although the page count slowly updates to the correct number after the macro stops. This suggests that the document hasn’t been properly paginated so Word is using the wrong page numbers for the fields. In view of this, I’ve added code ActiveDocument.Repaginate in the macro before updating the fields in the footnotes, but that doesn’t solve the problem.

The odd thing is that if I run the macro a second time, then the fields in the footnotes are properly updated. But if I close the document and reopen it and rerun the macro, then it fails again.

If I manually update the fields in the footnotes in a newly opened document (i.e., by clicking in the footnotes, entering Ctrl+a, and executing UpdateFields), then Word updates the fields properly.

Can you suggest an improvement to the macro to ensure that the fields in the footnotes will be properly updated the first time the macro runs?

Thanks for your help,

Don Macnaughton

How do I make a picture span two pages in Word?

$
0
0

I have an image 10" wide by 27" tall.  I paste it into a word document, adjust the paper to 11x17 and the margins to 0.5", click PRINT, and I only get the first 16 inches on the front of the paper.  I would like to print it so it automatically splits and puts the first 16 inches on the front of the paper, and the remainder on the back.  Is this possible?

ASP, IIS 6.0, Javascript and Microsoft Word 2013

$
0
0

Hello everyone,<o:p></o:p>

hope someone has some nice idea to help us today!<o:p></o:p>

We are running an asp based application on a windows server with IIS 6.0,  (ODBC = dBASE, xls, mdb). our application first collect data from database tables, it open an .doc file (objword.Documents.Open and var objword = new ActiveXobject ("word.application") and populate data in the document called tax.doc or tax.docx (Rows and Cells).<o:p></o:p>

We use Javascript code to accomplish that. It works fine with the MS Word version 2010 but not in Word 2013.<u1:p></u1:p><o:p></o:p>

strange enough, that the Word 2013 open out tax.doc or tax.docx template well, but without any data been populate in the Rows, Cells as it does in Word 2010.<u1:p></u1:p><o:p></o:p>

my question:<o:p></o:p>

Anyone, any idea why? And what is not included or has been removed/turned off  in Word 2013?<o:p></o:p>

 

<u1:p>thank you in adv.</u1:p><o:p></o:p>

Fraidon

How to identify merged column and row in word table?

$
0
0

Hi

I need to read all the text from a table. By using below I can read the content from table.https://1drv.ms/w/s!Ah-Jh2Ok5SuHdnlXy61Z2ZZRX2o here I uploaded a dummy Docx file having tables.

foreach (Word.Row row in tb.Rows)

{

        foreach (Word.Cell cell in row.Cells)

        {

                      string cellText = "";

                      if (cell.Range != null)

                      {

                                      cellText = cell.Range.Text.ToString().Trim().Replace("\r\a","");

                      }

        }

}

But for below 3 cases I face problem.

Case 1: Showing in Table 1, two column cells were merged. By using above code I am able to read the all the values but it has one less iteration as compared to other rows. Here how can I identify whether that row has merged cell/s?

Case 2: Showing in Table 2, here 2 rows were merged. While iterating I get below error fromtb.Rows

Cannot access individual rows in this collection because the table has vertically merged cells.

Here how can I identify whether a table have merged row or not?

Case 3: Showing in Table 3. Here a table is inside a table. By using above code it identify only one table andcellText = cell.Range.Text.ToString().Trim().Replace("\r\a", "");at the end of this lines execution  cellText get all the values of the current cell + inner table cell values. i.e. 2abcd. Here How can I iterate inner tables?    

Is it possible to have a word doc, with one background color to some point, THEN after that point a different color.

$
0
0

what I am trying to find out if possible is this.

I create a lot of documents (for me ) where it I have a the working document, AND various notes, ideas, tasks listed also.

Problem is from time to time, I start adding text in the "Notes" section instead of the "doc" section.

And it can be a pain to make sure to get all of the "answer" from notes section and in the "doc" section.

one author mentioned what he did With Microsoft Word was have two sets of fonts, colors, one for each PART of word document.

with a very different background for "Notes" or "Final doc"  "Section" of word file. 

The "Final Doc" section is the part word doc that would be the part to be published.

I wonder if the way to do this would be to Create two sets of paragraph styles one set for paragraph and header1 styles in "Final Doc" and in "Notes"

and apply the style?

I did get lots of links to helpful info about styles and templates, BUT I couldn't find info about this.

any help can you can give will help


Mark J

Not getting Proper Image while Converting word to html using Microsoft.Office.interopp.word

$
0
0

Hello Everyone,

Hello Everyone, 

While Converting Doc to HTMl we are not getting High Quality image so we can not reuse the same we are getting gif image which is low quality while converting word to html.


Below is the Code snippet for the same.

public static void ConvertDocToHtml(object Sourcepath, object TargetPath)
        {
            Word._Application newApp = new Word.Application();
            Word.Documents d = newApp.Documents;
            object Unknown = Type.Missing;
            Word.Document od = d.Open(ref Sourcepath, ref Unknown,
                                     ref Unknown, ref Unknown, ref Unknown,
                                     ref Unknown, ref Unknown, ref Unknown,
                                     ref Unknown, ref Unknown, ref Unknown,
                                     ref Unknown, ref Unknown, ref Unknown, ref Unknown);
            object format = Word.WdSaveFormat.wdFormatFilteredHTML;
            newApp.ActiveDocument.SaveAs(ref TargetPath, ref format,
                        ref Unknown, ref Unknown, ref Unknown,
                        ref Unknown, ref Unknown, ref Unknown,
                        ref Unknown, ref Unknown, ref Unknown,
                        ref Unknown, ref Unknown, ref Unknown,
                        ref Unknown, ref Unknown);
            newApp.Documents.Close(Word.WdSaveOptions.wdDoNotSaveChanges);
            // MessageBox.Show("File Converted Successfully");

        }

=======

Thanks,

How to read inner table Data in word?

$
0
0

Hi

By using below code I am able to read the data cell by cell bu if a table contain another table one of its cell then the the code return all the text of inner table.

How can I read the data cell by cell of inner table?

foreach (Word.Row row in tb.Rows)
{
   foreach (Word.Cell cell in row.Cells)
   {
	string cellText = "";
	if (cell.Range != null)
	{
	    cellText = cell.Range.Text.ToString().Trim().Replace("\r\a", "");
	}
    }
}


Converion of word to PDF to render it in the PDF (ASP.NET C#)

$
0
0

Dear Team,

I have an asp.net application, in that one functionality I need to show the word document in the browser by highlighting few keywords in the word document.

Finding the keyword to highlight I am using below code.

Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();

public Microsoft.Office.Interop.Word.Document wordDocument { get; set; }  

string dummyFile = “File path”;

wordDocument = appWord.Documents.Open(dummyFile); 

var range = wordDocument.Range();

while (range.Find.Execute(word))

{

Microsoft.Office.Interop.Word.Range tmpRange = wordDocument.Range(range.Start, range.End);

tmpRange.HighlightColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdDarkYellow;

tmpRange.Font.ColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdYellow;

matchCount++;

}

Microsoft.Office.Interop.Word.Range tmpRange1 = wordDocument.Range(0, 0);

if (matchCount > 0)

{

tmpRange1.Text ="Match Count : "+ matchCount +"\n\n";

      tmpRange1.Font.ColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdBlue;

      tmpRange1.Font.Size = 12;

      tmpRange1.Font.Bold = 1;

      tmpRange1.InsertParagraphBefore();

}

wordDocument.ExportAsFixedFormat(dummyFile +".pdf",WdExportFormat.wdExportFormatPDF);

var bytes = System.IO.File.ReadAllBytes(dummyFile.ToLower().Replace(".doc","").Replace("x","") +""+".pdf");

Context.Response.ContentType ="application/pdf";

Context.Response.AddHeader("Content-disposition","inline");

Context.Response.BinaryWrite(bytes.ToArray());

The above code is working as expected, Finding the keyword occurrences count and inserting the text in 0<sup>th</sup> position of word document. Then converting the word to PDF using WdExportFormat.wdExportFormatPDF.

The problem here to be solved is, this code shows me the PDF only if a administrator logged in the server. After log off it shows the below exception.

System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A). at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type

Even, I have created a local user and configured DCOM given the credentials. Still it is not working.

Any help in this would be highly appreciable.


Selvakumar Rathinam

Issue with Keyboard hook for scanning for hypen(“-”) and equal sign(“=”)

$
0
0

I use windows C++ Keyboard hook to use USB scanner. Problem happens during scanning if QR code/barcode contains “=” and “-“. Key board hook gets wrong hexa data( i.e. ?(ffffffbb)) for these special characters. All other character gets scan correctly It would be great if you can suggest some possible solution for this problem. Thanks for taking a looking at this and please let me know if any additional information is required.

Sample key board hook code

clspec(dllexport)LRESULT __stdcall HookCallback(int iCode, WPARAM wParam, LPARAM lParam){CString str, strBuffer;

        str.Format( _T("lParam =%c(%0x),wParam = %c(%0x)"),(char)lParam,(char)lParam,(char)wParam,(char)wParam  );
        CT2CA pszConvertedAnsiString (str);

        string str1(pszConvertedAnsiString);// = temp.GetBuffer(temp.GetLength());
        ofstream myfile;
        myfile.open ("ScanData.txt",ios::out | ios::app | ios::binary);
        myfile<<str1<<endl;//  Translation table from base characters to shifted characters.charFrom[]="`1234567890-=\\[];',./";charTo[]="~!@#$%^&*()_+|{}:\"<>?";// if not an action event or MSR is not active, go to the next hookif(iCode <0|| iCode != HC_ACTION )returnCallNextHookEx(_hook, iCode, wParam, lParam);// Check if shift key is pressed.if(wParam ==0x10&&(lParam &0xc0000000)==0){
          myfile<<"Inside  TRUE"<<endl;
          m_bShift = TRUE;}if(wParam ==0x10&&(lParam &0xc0000000)!=0){
          myfile<<"Inside  FALSE"<<endl;
          m_bShift = FALSE;}// clear existing buffer and post messageif( wParam ==0x0d){
          myfile<<"End of scanning"<<endl;CharStringToCString( m_Buffer, strBuffer, strlen( m_Buffer ));
          myfile<<m_Buffer<<endl;

          m_Buffer[0]=0;
          m_nBufferIndex =0;return1;}else{if(m_bShift)//converting the character if shift pressed{
              myfile<<"Inside shift"<<endl;int i =0;while(From[i]!=0&&From[i]!=(char)wParam) i++;if(From[i]==(char)wParam)// Translate to shifted{
                  myfile<<"Inside shift2"<<endl;
                  wParam =(int)To[i];//   character}}if((lParam &0xc0000000)==0&& wParam !=0x10){
        myfile<<"Append to buffer"<<endl;
        m_Buffer[m_nBufferIndex++]=(char)wParam;// Append character to buffer
        m_Buffer[m_nBufferIndex]=0;}return1;}// If not Scanner data, chain to next hook procedurereturnCallNextHookEx(_hook, iCode, wParam, lParam);}voidSetHook(){
        HOOKPROC hkprc;
        hhookDLL =LoadLibrary(TEXT("..\\Debug\\KeyboardDLL.dll"));if(!hhookDLL)MessageBox(NULL, _T("Failed to get hhookDLL!"), _T("Error"), MB_ICONERROR);
        hkprc =(HOOKPROC)GetProcAddress(hhookDLL,"_HookCallback@12");if(!hkprc)MessageBox(NULL, _T("Failed to get hkprc!"), _T("Error"), MB_ICONERROR);elseMessageBox(NULL, _T("Scan QR/Bar code and check 'ScanData.txt'!"), _T("INFO"), MB_ICONINFORMATION);
        _hook =SetWindowsHookEx(
                            WH_KEYBOARD,
                            hkprc,
                            hhookDLL,0);if(!_hook)MessageBox(NULL, _T("Failed to get _hook!"), _T("Error"), MB_ICONERROR);}

output:Insideelse shiftInsideelse shift 2**lParam =(1),wParam =?(ffffffbb)(******Wrong******for=)**Insideelse shiftAppend to buffer
    lParam =(1),wParam =?(ffffffbb)Insideelse shift
    lParam =(1),wParam =(d)End of scanning

How to extract colored or highlighted texts from a document?

$
0
0

Hi,

I have a document. Some texts are in dark blue, text 2, lighter 40%. The RGB of it is 31,73,125.

And there are also texts in yellow highlight.

I want to know the macro way to extract these texts.

Please help!!!

Regards,

LCC

Dictionary word 2016 English Uk

$
0
0
ms as Milliseconds is not a word in the word 2016 library, could someone add it?

Content Control Event Handlers does not trigger when document opened from SharePoint

$
0
0

I have developed a custom Word Add-In, which subscribes to ContentControl Enter and Exit event handlers. These event handlers work as expected when the document is opened from local system. When the same document is opened from SharePoint,  the event handler stops triggeringintermittently. 

Particularly, when we enter some content and exit: EXIT event handler stops triggering and also ENTER handler. Event handlers starts working after a few attempts entering/exiting. Again when we enter some, it will stop.

To reproduce the behavior, I have created a test application with the following code. It will be awesome if you could help.

IMPORTANT NOTE: We face this issue only in Word 2010.

Environment Details:

Operating System: Windows 7

Office Version: Word 2010 (v14.0.7177.5000 - 32BIT).

SharePoint: 2013 

Document Open:

void Application_DocumentOpen(Word.Document PobjDocument)
        {
            System.Windows.Forms.MessageBox.Show("Document open fired");            
            using (Document LobjExtendedDocument = Globals.Factory.GetVstoObject(PobjDocument))
            {
                foreach (Word.ContentControl LobjContentControl in LobjExtendedDocument.ContentControls)
                {
                    switch (LobjContentControl.Type)
                    {
                        case Word.WdContentControlType.wdContentControlRichText:
                            RichTextContentControl LobjRichTextContentControl = LobjExtendedDocument.Controls.AddRichTextContentControl(LobjContentControl, Guid.NewGuid().ToString());
                            LobjRichTextContentControl.Entering += LobjRichTextContentControl_Entering;
                            LobjRichTextContentControl.Exiting += LobjRichTextContentControl_Exiting;                           
                            break;
                    }
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(LobjContentControl);
                }
            }
        }

Entering Event Handler:

void LobjRichTextContentControl_Entering(object sender, ContentControlEnteringEventArgs e)
        {
            MessageBox.Show("Entering Event Fired!");
        }

Exit Event Handler:

void LobjRichTextContentControl_Exiting(object sender, ContentControlExitingEventArgs e)
        {
            MessageBox.Show("Exiting Event Fired!");
        }

Fields Update

$
0
0

How do we pragmatically find out that fields needs to be updated in the document before calling fields.Update()??

Thanks!

Testing hyperlinks in footnotes

$
0
0

Hi,

Does anyone have a script for testing hyperlinks in their footnotes? My script works for testing hyperlinks in the body of the word document but not for the footnotes.

Thanks




Best approach to develop a MS Word plugin that supports from MS Office Word 2007 to 2016

$
0
0

We need to develop a MS Office Word plugin that must be compatible with office 2007 to all the way up current version. The plugin will be delivered with a desktop app that we are developing using Electron. We want a single code base for the plugin that supports all the versions of MS office. What will be the best approach for us? Plugins that are developed in Office JavaScript API - are they compatible with older versions of MS Office (eg. Office 2007) or should we go for C# or any other alternative?



Word Template Automation Question

$
0
0

Hello,

I have virtually no experience with developing anything involving Microsoft Office Word.  However, our team keeps running into problems which I think could be easily solved if we found a way to automate Word Document Creation.

Basically, the problem is we daily generate word document reports that are formatted as similar to each other as possible and we currently do this manually.  I am hoping that there might be a way where we have text fields or something and once we input our data into those text fields and click run our program will take that user supplied data and automatically ensure the formatting is correct and will generate a Word Document report.  When we do this manually we spend way too much time adjusting line space, changing image sizes, configuring dates into a certain format, etc.  Does anyone have any ideas, suggestions, or advise on how to make this process more efficient?

Thanks in advance,

Joe

Interop::Word::Table Compiler error C3293 and C2227

$
0
0

Hi Every One

I try to insert Text in a addet Table. The Compiler always give me Error.

I develope with Visual Studio 2015 and C++/CLI.

Schweregrad    Code    Beschreibung    Projekt    Datei    Zeile    Unterdrückungszustand

Fehler    C3293    "Range": Verwenden Sie "default", um auf die Standardeigenschaft (Indexer) der Microsoft::Office::Interop::Word::Cell-Klasse zuzugreifen.    UWHP    J:\Visual Studio 2015\Projects\UWHP\UWHP\clWord.cpp    56   

"Mistake C3293 to "rank": Use "default" to access the standard quality (Indexer) Microsoft:: office:: Interop:: Word:: Cell class. Studio UWHP J:\Visual 2015\Projects\UWHP\UWHP\clWord.cpp 56 "

Fehler    C2227    Links von "->Text" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden.    UWHP    J:\Visual Studio 2015\Projects\UWHP\UWHP\clWord.cpp   56   

"Mistake C2227 of link from "-&gt; text" a pointer must be on classes and structure and union and generic type. Studio UWHP J:\Visual 2015\Projects\UWHP\UWHP\clWord.cpp 56"

This is my Project:

clWord.h

#pragma once

#ifndef __clWord_H__
#define __clWord_H__

using namespace System;
using namespace Microsoft::Office;
using namespace Microsoft::Office::Interop;
using namespace Microsoft::Office::Interop;

// ---------------------------------------------------------------------------

public ref class  clWord {
private:

public:
	clWord(void);
	~clWord(void);
	void Word_export( String^ strDatei);
};

#endif

clWord.cpp

// ---------------------------------------------------------------------------
#include "StdAfx.h"
#include "clWord.h"

// ---------------------------------------------------------------------------

clWord::clWord(void) 
{
}
//-----------------------------------------------------------------------------------

clWord::~clWord(void) 
{
}
//-----------------------------------------------------------------------------------

void clWord::Word_export(String^ strDatei) {
	int iPosition;
	int iInsertParagrap = false;
	int iZeile = 30;
	int iMaxSpalten = 3;
	int iZ, iSp;
	String^ strTemp = gcnew String("");
	String^ strText = gcnew String("");
	Microsoft::Office::Interop::Word::_Application^ oWord = gcnew Word::ApplicationClass();
	Microsoft::Office::Interop::Word::_Document^ oDoc;
	Microsoft::Office::Interop::Word::Table^ oTable;
	Microsoft::Office::Interop::Word::Range^ wrdRng;

	Object^ oMissing = System::Reflection::Missing::Value;
	Object^ oEndOfDoc = gcnew String("\\endofdoc");		// endofdoc ist eine vordefinierte Textmarke 
	Object^ oBookmark;
	Object^ oOpenFile = gcnew String(strDatei);
	Object^ oSaveOption;
	try {
		oSaveOption = Word::WdSaveOptions::wdSaveChanges;
		oDoc = oWord->Documents->Open(oOpenFile, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
		oWord->Visible = true;
		strTemp = "Tab_Anfang";
		if (oDoc->Bookmarks->Exists(strTemp)) {
			oBookmark = gcnew String(strTemp);
		}
		else {
			oBookmark = oEndOfDoc;
		}
		wrdRng = oDoc->Bookmarks[oBookmark]->Range;
		oTable = oDoc->Tables->Add(wrdRng, iZeile, iMaxSpalten, oMissing, oMissing);
		oTable->Borders->OutsideLineStyle = Word::WdLineStyle::wdLineStyleSingle;
		oTable->Borders->OutsideColor = Word::WdColor::wdColorBlack;
		oTable->TableDirection = Word::WdTableDirection::wdTableDirectionLtr;
		oTable->Borders->InsideLineStyle = Word::WdLineStyle::wdLineStyleSingle;
		oTable->Borders->InsideColor = Word::WdColor::wdColorBlack;
		iZ = 1;
		strText = gcnew String("Nachname Vorname");
		for (iSp = 1; iSp <= iMaxSpalten; iSp++) {
			oTable->Cell(iZ, iSp)->Range->Text = strText->ToString();
		}
	}
	catch (Exception^ e) {

	}
}
// ---------------------------------------------------------------------------
Any Help?

How to collapse ribbon for office 2016 Word 2016 and Excel 2016 using c# code or VSTO.

$
0
0

Hi ,

 How to collapse ribbon for office 2016 Word 2016 and Excel 2016 using c# code or VSTO.

Please give any suggestions.

Regards,

Kiran R.

Help inserting a paragraph, table and page break in a for loop at a specific bookmark. C# Word Interop

$
0
0

Hi

I am creating a word doc from a template.  The template only has bookmarks to give me places to insert certian text, table, etc.

I have a for each loop which needs to create a set of Text (A heading using 'Heading 1' for the tavble of contents), more text, a table and then a page break and then the next pass through the for loop should put similar items on the next page.  The stuff in my loop works as needed but I can't get it to start at a specific bookmark.  Code snippet follows.

Object bookmarkContent = "Content";
Word.Range rngContent = wordDoc.Bookmarks.get_Item(ref bookmarkContent).Range;
Word.Bookmark contentBookmark = wordDoc.Bookmarks.get_Item(ref bookmarkContent);
contentBookmark.Select();
foreach (ListViewItem workflow in listView1.SelectedItems)
{
    Word.Paragraph para1 = wordDoc.Content.Paragraphs.Add(misValue);
    //para1.Range.set_Style("Heading 1");
    para1.Range.Text = workflow.SubItems[0].Text;
    para1.Range.set_Style(Word.WdBuiltinStyle.wdStyleHeading1);
    para1.Range.InsertParagraphAfter();
    Word.Table firstTable = wordDoc.Tables.Add(para1.Range, 5, 2, ref misValue, ref misValue);
    firstTable.set_Style(Word.WdBuiltinStyle.wdStyleTableLightShadingAccent1);
    firstTable.Borders.Enable = 1;
    firstTable.Cell(1, 1).Range.Text = "Description";
    firstTable.Cell(1, 2).Range.Text = workflow.SubItems[1].Text;
    firstTable.Cell(2, 1).Range.Text = "Primary Entity";
    firstTable.Cell(2, 2).Range.Text = workflow.SubItems[2].Text;
    firstTable.Cell(3, 1).Range.Text = "Scope";
    firstTable.Cell(3, 2).Range.Text = workflow.SubItems[3].Text;
    firstTable.Cell(4, 1).Range.Text = "State";
    firstTable.Cell(4, 2).Range.Text = workflow.SubItems[4].Text;
    firstTable.Cell(5, 1).Range.Text = "Status";
    firstTable.Cell(5, 2).Range.Text = workflow.SubItems[5].Text;
    para1.Range.InsertBreak(Word.WdBreakType.wdPageBreak);
}
wordDoc.TablesOfContents[1].Update();

Thanks for the help.

Paul

Viewing all 4350 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>