我正在尝试以编程方式填写 microsoft word 表格。如果字符串小于 255 个字符,我可以使用下面的代码成功地做到这一点,但是如果我尝试使用超过 255 个字符的字符串,它会说字符串太长......我该如何克服这个限制?如果我在 word 中打开 word doc,我可以毫无问题地输入超过 255 个字符。有谁知道如何通过 c# 代码输入更多字符?
object fileName = strFileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
//open doc
_oDoc = _oWordApplic.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, ref missing, ref missing);
_oDoc.Activate();
//write string
_oDoc.FormFields[oBookMark].Result = value;
//save and close
oDoc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
_oWordApplic.Application.Quit(ref missing, ref missing, ref missing);