Hi,

Thank you Bernard for your answer.

> myCell.setFormula("=NA()")
This solved my #N/A problem.

> myCell.setString("")
In c++ there is no setString() method and setFormula("") does not set XCell
to CellContentType_EMPTY but rather 0 length string. Somebody else might
need this same answer later so, this is how I did it:

  Reference< XCell > xCell = xSheet->getCellByPosition( c, r );
  ...
  Reference< XSheetOperation >  xSheetOperation( xCell,UNO_QUERY);
  if ( ! xSheetOperation.is() )
   {
      // error ...
   }
  xSheetOperation->clearContents( VALUE|DATETIME|STRING|FORMULA );

http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/XSheetOperation.html
http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/CellFlags.html

regards,
petteri

Bernard Marcelly wrote:
> Message de Petteri Larjos  date 2009-02-13 15:34 :
>>
>> I am using UNO C++ API and need help with XCell interface (again).
>>
>> How I can set cell value to empty? I tried xCell->setFormula(OUString())
>> but xCell->getType() does not return CellContentType_EMPTY after that.
>> Any
>> ideas?
>>
>> I also need set cell to '#N/A'. How I can set error codes? I tried to
>> xCell->setValue(NAN) but it gives '#NUM!'.
>>
> 
> Hi,
> Answers are in Basic.
> 
> ' setting cell to empty
> myCell.setString("")
> ' setting cell to NA
> myCell.setFormula("=NA()")
> 
> Remark: the subject of your mail has no relation with the question.
> 
> Regards
>   Bernard
> 
> 


-- 
Petteri Larjos                             /"\
609 90225,050-5587347                      \ /  ASCII Ribbon Campaign
ETLA                                        X  -NO HTML/RTF in e-mail
                                           / \ -NO Word docs in e-mail

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to