TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prabhu
NA
64
12k
Creating Table in word using interop dll
Jan 23 2019 6:49 AM
Hi,
I need to create table with default Header template
When i coding ima facing one error
"Additional information: Cannot access individual rows in this collection because the table has vertically merged cells"
following code
object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc";
Microsoft.Office.Interop.Word._Application objWord;
Microsoft.Office.Interop.Word._Document objDoc;
objWord = new Microsoft.Office.Interop.Word.Application();
objWord.Visible = true;
objDoc = objWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
int i = 0;
int j = 0;
Microsoft.Office.Interop.Word.Table objTable;
Microsoft.Office.Interop.Word.Range wrdRng = objDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
objTable = objDoc.Tables.Add(wrdRng, 5, 5, ref oMissing, ref oMissing);
objTable.Range.ParagraphFormat.SpaceAfter = 7;
string strText;
strText = "Failure Mechanisms";
objTable.Rows[1].Range.Text = strText;
objTable.Rows[1].Range.Font.Bold = 1;
objTable.Rows[1].Range.Font.Size = 12;
objTable.Rows[1].Range.Font.Position = 1;
objTable.Rows[1].Range.Font.Name = "Times New Roman";
objTable.Rows[1].Cells[1].Merge(objTable.Rows[3].Cells[1]);//fine
objTable.Rows[1].Cells[2].Merge(objTable.Rows[1].Cells[3]);// error line
//objTable.Rows[1].Cells[1].Merge(objTable.Rows[3].Cells[1]);
objTable.Cell(1, 1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
When i trying to merge Row 1 to Row 3 of Cell 1 it working fine
when i trying to merge next row or next column i am facing this error
Kindly help with good solution fro this
And also help with how to split cell
Thanks in advance
Reply
Answers (
2
)
how to avoid page refresh in asp.net mvc ?
comma separator in textBox field