RE: uno api problem
I already fixed this problem this way:неинеиint nLenOfWideCharStr =неи MultiByteToWideChar(неиCP_ACP,неи MB_PRECOMPOSED,неиfontName,неи-1,неи NULL,неи0неи);неинеи wchar_t *cFontName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, nLenOfWideCharStr * sizeof(WCHAR));неинеи MultiByteToWideChar(неиCP_ACP,неи MB_PRECOMPOSED,неиfontName,неи-1,неиcFontName,неи nLenOfWideCharStrнеи);неинеи OUString sstring = cFontName;неинеи rColProps-setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(CharFontName)), makeAny(sstring));неинеиThanks :)неинеинеи-Original Message-неиFrom: jg [mailto:j...@jgoettgens.de] неиSent: Saturday, April 06, 2013 3:15 PMнеиTo: api@openoffice.apache.orgнеиSubject: Re: uno api problemнеинеиThis might also work:неинеиxPropertySet-setPropertyValue(LCharFontName, makeAny(OUString((const неиsal_Unicode *)LCorbel)));неинеиOr, if the value is not a constant (MFC):неинеиCStringW value;неи...неиOUString value((const sal_Unicode *)((LPCWSTR)value));неиxPropertySet-setPropertyValue(LCharFontName, Any(value));неинеинеинеиjgнеинеи-неиTo unsubscribe, e-mail: api-unsubscr...@openoffice.apache.orgнеиFor additional commands, e-mail: api-h...@openoffice.apache.orgнеинеи
Re: uno api problem
On Sun, Apr 07, 2013 at 04:06:19PM +0300, k.misha wrote: I already fixed this problem this way: [...] not portable at all. You may find useful the C++ UNO binding reference: http://www.openoffice.org/api/docs/cpp/ref/names/index.html Regards -- Ariel Constenla-Haile La Plata, Argentina pgpOu55N5lgMb.pgp Description: PGP signature
Re: uno api problem
Hi k. misha, On Thu, Apr 04, 2013 at 11:20:04AM +0300, k.misha wrote: Hi! I have some problems using UNO API! I have this example: Int x = 0; Int y = 1; Char * fontName = Corbel; Defined this way, fontName is a pointer Reference XSpreadsheet rSpSheet (rSheet, UNO_QUERY); Reference XCell rCell = rSpSheet-getCellByPosition(x, y); Reference XPropertySet xPropSet(rCell, UNO_QUERY); OUString sstring = OUString(RTL_CONSTASCII_USTRINGPARAM(fontName)); The macro RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) expands to constAsciiStr, ((sal_Int32)(sizeof(constAsciiStr)-1)), RTL_TEXTENCODING_ASCII_US so that sizeof( pointer ) - 1 is 4 - 1 (in 32 bit arch.) or 8 - 1 (in 64 bit arch.) xPropSet-setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(CharFontNam e)), makeAny(sstring)); But when I look into a cacl document, there is wrong value in cell(0,1). I's Cor. But must be Corbel. Your OS is 32 bits: (sizeof( pointer ) - 1) is 3, thus Cor. Can you help me and show where I'm wrong? Define the string literal as an array: const char fontName[] = Corbel; or simply avoid all these temporal variables: xPropSet-setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM(CharFontName)), makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM(Corbel; Regards -- Ariel Constenla-Haile La Plata, Argentina pgp8F0gaTmsIz.pgp Description: PGP signature