Le Mardi 13 Septembre 2005 10:46, Tom Schindl a écrit : > Hi, Hello Tom,
> Thanks for your contribution your snippet has been added here: > http://codesnippets.services.openoffice.org/Office/Office.FindDocumentForma >t.snip About code snippet, I have some small ones for C++. I put the text here. If you want to add them on the site and want them to be formated in particular format, just tell me. I - Howto access Sequences The problem is the following : from a function, you get a Sequence. Example : Sequence< ::rtl::OUString > sq = rxOfficeServiceManager->getAvailableServiceNames(); How to display the content of the object ? This is done using the sequence as an array. Example : sq.getLength(); // returns he number of objects in the sequence. OUString a = sq[1]; OUString b = sq[801]; // sq.getLength() - 1 II - Iterate over a sequence Example : Sequence< ::rtl::OUString > sq = rxOfficeServiceManager->getAvailableServiceNames(); rtl::OString aOString; const ::rtl::OUString* sIterator = sq.getConstArray(); const ::rtl::OUString* sEnd = sIterator + sq.getLength(); for ( ; sIterator != sEnd ; ++sIterator) { aOString = ::rtl::OUStringToOString ( *sIterator, RTL_TEXTENCODING_UTF8 ); cout << "sq : " << aOString << endl; } III - Howto print OUStrings In fact, to print an OUString, you need to convert it in a OString. Here is an example : OUString aouString = OUString::createFromAscii( "Coucou" ); OString aOString = ::rtl::OUStringToOString ( aouString, RTL_TEXTENCODING_UTF8); cout << "aouString : " << aouString << endl; cout << "aOString : " << aOString << endl; Result in compilation : aouString : 0xb5b87fd8 aOString : Coucou cheers, Pierre-André -- StarXpert - www.starxpert.fr e-mail : [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
