单词表隐藏前面的文本行

本文关键字:文本 前面 隐藏 单词表 | 更新日期: 2023-09-27 18:15:04

我的项目是窗口形式在第一行我写了一个文本到ms word,然后我试图画表后的文本(在下一行,我的意思是行2),表是可见的,但隐藏了以前的文本。我需要表在下一行。我如何解决这个错误我还需要在表

后面再写一个文本
start = Type.Missing;
end = Type.Missing;
rng_x = oDataDoc.Range(ref start, ref end);
rng_x.Text = "name ,grade and age etc...  ";
rng_x.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
start = oDataDoc.Characters.Count;
end = Type.Missing;
rng_x = oDataDoc.Range(ref start, ref end);
Nrow=4; Ncolumn=8;
oDataDoc.Tables.Add(rng_x, Nrow, Ncolumn, ref defaultTableBehavior, ref      AutoFitBehavior);
 Word.Table tbl = oDataDoc.Tables[1];

单词表隐藏前面的文本行

找到了答案

start = Type.Missing;
end = Type.Missing;
rng_x = oDataDoc.Range(ref start, ref end);
rng_x.Text = "hellow";
rng_x.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
float wordY = (float)rng_x.get_Information(Microsoft.Office.Interop.Word.WdInformation.wdHorizontalPositionRelativeToPage);
istart = (int)wordY;
iend = (int)wordY;
rng_x.SetRange(istart,iend);
Nrow=4; Ncolumn=8;
oDataDoc.Tables.Add(rng_x, Nrow, Ncolumn, ref defaultTableBehavior, ref autoFitBehavior);
Word.Table tbl = oDataDoc.Tables[1];