Forwarding Herbert's answer in case the original poster did not get it.
Andrea
On 29/04/2014 Herbert Duerr wrote:
On 29.04.2014 14:15, K. Misha wrote:
Our company has developed LibOpenOffice
<http://4k.com.ua/products/others/libopenoffice?lang=en> library for
OpenOffice automation. Our clients from China said that this code doesn't
work with chinese file path:
bool exportToUrl(char *url) {
try {
int nLenOfWideCharStr =
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,url,-1,NULL,0);
wchar_t *uval = (PWSTR)HeapAlloc(GetProcessHeap(), 0,
nLenOfWideCharStr * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,url,-1,uval,nLenOfWideCharStr);
Reference<XStorable> xStore (xCalcComponent, UNO_QUERY);
Sequence<PropertyValue> storeProps(1);
storeProps[0].Name = OUString::createFromAscii(
"FilterName" );
storeProps[0].Value <<= OUString::createFromAscii( "MS
Excel 97"
);
xStore->storeToURL( OUString::OUString(uval), storeProps );
Use a line such as
xStore->storeToURL( OUString::OUString(uval,nLenOfWideCharStr),
storeProps );
instead. This sets the string length explicitly instead of relying on
finding a trailing zero.
Hope that helps.
Herbert
---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org