Microsoft Interops Word Insert Comment into Table Cell Crash Word

i want open a word document programmatically using Microsoft.Interop.Word and insert a comment into a table cell. I have the start and End position of Range of the cell. (Range.Start \ Range.End)

Application.ActiveDocument.Select(); // select ative document Range rg = Application.Selection.Range; // get the range of the current selection (all document) if (rg.Tables.Count > 0) { Microsoft.Office.Interop.Word.Range rngTab = rg; //set the coordinate of the Range of the text rngTab.Start = startRng; rngTab.End = endRng; doc.ActiveWindow.Visible = true; rg.Select(); Application.ActiveDocument.Comments.Add(rngTab, ref commentText); }

When insert comment Word Crashes

-------------Problems Reply------------

I convert your code to pascal with some changes. It work fine, without error! See it

var WApplication:twordapplication; rg,rngTab:range;
WApplication := twordapplication.Create(form1);
rg:= WApplication.Selection.Range; // get the range of the current selection (all document)
rngTab:= rg;
//set the coordinate of the Range of the text
rngTab.Start:= 1;
rngTab.End_:= 2;
WApplication.ActiveDocument.Comments.Add(rngTab, commentText);// add comment to text
WApplication.ActiveDocument.Comments.Add(rngTab, commentText); // add comment to cell in the table

Category:c# Views:19 Time:2018-12-20

Related post

  • Inserting comments into a cell 2013-07-10

    *VAC 2010+12.00 *VAC 2010+12.00 *VAC 2010+12.00 I insert a comment into a cell. When completed and the curser is run over the comment icon teh text box appears hundreds of rows below the cell and the text box itself has collapsed. Any thoughts? -----

  • insert image into table cell in javascript 2013-06-07

    I want to insert images to the new cell created .How can i do. Can anyone guide me in doing it. Here's my code to insertcells <!DOCTYPE html> <html> <head> <script> function displayResult() { var firstRow=document.getElementBy

  • how do I insert a comment into a cell 2014-05-26

    How do I insert a comment into a cell? --------------Solutions------------- rt click on the cell to bring up the context menu Hi, Sadly you can't insert any comments in a cell using Starter Edition, you need to upgrade it to full version. http://www.

  • How best to insert a graphic into table cells? 2013-10-24

    Hi, I need to use the Autotext (building blocks) feature to insert a graphic into table cells. A macro is going to be used to accomplish this. How can I save the graphic in the autotext feature so that it comes into the table cells appropriately? Sho

  • How to insert drop-down-list into table cell? 2014-12-15

    Is it possible to insert drop-down-list into table cell? Thank you! Here is some of the code: $sql_query="SELECT nameOfwarning FROM warnings"; $sodss=mysqli_query($d,$sql_query); if (mysqli_num_rows($result)<1) ?> <select name = "warnings"

  • How to insert data into table 2012-04-12

    I need to know how to insert data into table. For example (Table - students info) : No | Student Name | Address | Phone Number 1. | Add | | Add - is a hyperlink. The user need to click Add(hyperlink) to add student. After the user click Add, then thi

  • Extract data in a cell comment into a cell? 2013-10-27

    I have a spreadsheet that has cell comments and I need to get the text and values that are in these comments into a cell. Is this possible? --------------Solutions------------- > .. is it possible to have each comment go into it's own cell? Try th

  • Formatting the Inserted Comment of a Cell 2014-03-02

    I'm using Excel 2007 and I know how to (i) insert a comment into a cell, and (ii) how to format said comment. What I can't figure out—and I know I have done this the past—is how to delete or change the colour of the drop shadow of the comment. Every

  • Trying to INSERT values into tables that contain FOREIGN KEYS that reference each other 2014-05-26

    So i'm trying to make a database based off a spec sheet (was given an ER diagram and a DB Schema) and said sheet specifies that the first two table contain references to each other, like so: WAREHOUSE Column name Data type Comments warehouseID VARCHA

  • How to find and replace text inside a table cells in word document? 2015-01-29

    Hi, In a word document table, I need to find the text Orange, Grapes & Guava in column 2 and update the text in corresponding cell in column for the same row as “Like”. Col 1 Col 2 Col 3 Apple Like Orange Dislike Grapes Dislike Blue Berry Dislike

  • Is it possible to disable index from function while inserting records into table and enable otherwise 2011-12-14

    Is it possible to disable index from oracle function while inserting records into table and enable it once insertion completed ? --------------Solutions------------- If your indexes are constraints based i.e. primary key, unique key you can disable o

  • Insert data into tables linked with foreign key 2012-01-13

    First of all I tried this Insert Data Into Tables Linked by Foreign Key and didn't get the answer. I have 3 tables: Table: Customers ID -------LastName-------FirstName-------PhoneNumber Table: Order ID-------Status-------CustomerID Table: OrderLine I

  • How to Insert a Newline into a Table Cell in Word? 2010-04-30

    when i insert '\r\n' into a cell of a table in word document using c# ,it does not work ,why ? how to do it ? Word.Application wordApp; Word.Document wordDoc; filePath = @"" + strWorkPath + @"Uploads\Template\template.doc"; saveFilePath = @"" + strWo

  • Inserting backgrounds into select table cells in word 2010 2012-08-08

    Hi, I need help in how to insert a background image into select cells into a an Avery template. Here's what I'm trying to do: I am printing labels with a coloured background (that is an image) on 8 1/2 x 11" paper. there are 50 labels per sheet. Temp

  • How to programmatically insert comments into a Microsoft Word document? 2009-02-20

    Looking for a way to programmatically insert comments (using the comments feature in Word) into a specific location in a MS Word document. I would prefer an approach that is usable across recent versions of MS Word standard formats and implementable

  • Insert row into table alphabetically on a certain cell 2011-06-21

    I am using jQuery to insert rows into a table after a database insert. When the page loads the table is ordered alphabetically on a particular cell (see below). When I insert a new row using jQuery I would like to be able to insert it alphabetically

  • User insert data into specific cell in an HTML table using PHP 2011-11-28

    Is it possible to specify the coordinates of an HTML table cell, x and y? If it is possible, then how can a user insert a value into that specified cell by submitting a form? Or is there a better way to do this? Thanks --------------Solutions--------

  • How to insert a graphic into table cells 2013-03-04

    I need to have 1 graphic image in each table cell and each table cell also needs to accommodate text. The graphic needs to be at the top of the cell and the text needs to be in the lower part of the cell. Right now I have the cell alignment "bottom"

  • Insert a Comment into every Page MS word 2014-09-30

    Hi, I would like to know if theres any way to do a MS Word Macro that would allow me to insert a comment bubble with the same comment in every page of my document. Prefably in the middle of the end of every page. I found out how to search for a word

  • Formula needed: look for key words "1", "2" into a cell and for each one write "x", "y" 2014-10-09

    Hi, I am using Excel 2007, and I need to find a formula that looks for key words into a cell, and writes something if it finds it. I have a very long column of rough data, that cannot be ordered so I need to find a way to translate them into a standa

  • How to copy a formatted cell in Excel to a table cell in Word using .NET? 2010-04-20

    I'm attempting to copy cells, one at a time, from an Excel 2003 (or 2007) spreadsheet to a Word 2003 (or 2007) table. I'd like the code to be version-agnostic, and so am using late binding. The formatting of the contents of the Excel cell, such as co

  • MS Word -- inserting comments 2012-01-26

    Really odd question: it's annoying but not earth shattering! When I'm inserting comments and typing in the reviewing pane, I run into problems of some characters not typing and I get the little error "bing". If I go back and type slowly, it works fin

  • How can I create a macro to highlight table cells in Word 2010? 2014-11-21

    Original Title: "Macro Stumped." I recently took the MOS Word 2010 Expert exam and was presented with two tasks I could not complete --creating a macro to highlight table cells. Is this doable without having to learn VBA? --------------Solutions-----

  • insert record into dataset cell from a loop 2010-07-20

    For j = 0 To wcData.Tables(0).Rows.Count - 1 For i = 900 To 1700 wcData.Tables("db").Rows(j)("range") = i Next Next trying to insert "i" into each column cell of "range" any suggestion. Thanks. --------------Solutions------------- Dim rowOffset As In

  • inserting images in table cell flush 2011-10-11

    everyone. The problem with arriving late to the web design party, is that I don't know how to use tables or cells. I am trying to insert an image into a cell that I know has 215x145px and my image has the same dimensions, only to find extra space in

Copyright (C), All Rights Reserved.

processed in 0.123 (s). 11 q(s)