Fill in word form field with more than 255 characters

Posted by user1308743 on Stack Overflow See other posts from Stack Overflow or by user1308743
Published on 2012-10-23T22:59:08Z Indexed on 2012/10/23 23:00 UTC
Read the original article Hit count: 278

Filed under:
|

I am trying to programmaticly fill in a microsoft word form. I am successfully able to do so if the string is under 255 chars with the following code below, however it says the string is too long if i try and use a string over 255 chars... How do I get past this limitation? If I open the word doc in word I can type in more than 255 chars without a problem. Does anyone know how to input more characters via c# code?

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);

© Stack Overflow or respective owner

Related posts about c#

Related posts about ms-word