когда я вставляю '\r\n'
в ячейку таблицы в документе слова с помощью C#, это не работает, почему? как это сделать ?Как вставить новую строку в ячейку таблицы в Word?
Word.Application wordApp;
Word.Document wordDoc;
filePath = @"" + strWorkPath + @"Uploads\Template\template.doc";
saveFilePath = @"" + strWorkPath + @"Uploads\" + VersionStr + @"\" + fileName;
object format = Word.WdSaveFormat.wdFormatDocument; wordApp = new Word.Application();
Object nothing = Missing.Value;
wordDoc = wordApp.Documents.Open(ref filePath, ref nothing, ref nothing, ref nothing, ref nothing,ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing);
Word.Table table = wordDoc.Tables[1];
table.Cell(1, 1).Range.Text = "sdsdlkfjdslk \r\n slkdfjslj";
как показано на последней строке.
В документе, это "sdsdlkfjdslk \r\n slkdfjslj"
, не "sdsdlkfjdslk slkdfjslj"
+1 Это сделало трюк для меня –
Для меня это не соответствует следующему исключению: '\ v', шестнадцатеричное значение 0x0B, является недопустимым символом. –