One more question... before changing text i have this:
Reference < XTextDocument > xTextDocument (xWriterComponent,UNO_QUERY);
Reference< XText > xText = xTextDocument->getText();
rtl::OUString uText = xText->getString();
rtl::OString str = rtl::OUStringToOString( uText,
RTL_TEXTENCODING_MS_1251 );
char * str1 = (char *) str.getStr();
Reference < XTextDocument > xTextDocument
(xWriterComponent,UNO_QUERY);
Reference< XText > xText = xTextDocument->getText();
int nLenOfWideCharStr =
MultiByteToWideChar(
CP_ACP,
MB_PRECOMPOSED,
str1,
-1,
NULL,
0
);
const wchar_t * wVal = (PWSTR)HeapAlloc(GetProcessHeap(), 0,
nLenOfWideCharStr * sizeof(WCHAR));
MultiByteToWideChar(
CP_ACP,
MB_PRECOMPOSED,
str1,
-1,
(wchar_t *)wVal,
nLenOfWideCharStr
);
Reference<XTextCursor> xTextCursor = xText->createTextCursor();
xTextCursor->goRight(iStartAt, 0);
xTextCursor->setString(wVal);
after this code all tables and other styles were deleted. How can i change
text without deleting it?