Issue 61520

Summary: Inconsistant behaviour when setting the formula or value of a Cell versa a CellRange
Product: App Dev Reporter: stephan.wunderlich
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: berend.cornelius, issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description stephan.wunderlich 2006-02-02 11:18:49 UTC
When you run the macro 

sub main
    oRange = ThisComponent.Sheets(0).getCellRangeByName("B1")
    oRange.Annotation.String = "My Comment"
    oRange.Formula = "=A1"
end sub

Then the Cell "B1" will contain the formula "=A1" and have a nice Annotation
too, but when you run the macro

Sub Main
    oRange = ThisComponent.Sheets(0).getCellRangeByPosition(0,0,3,3)
    ThisComponent.Sheets(0).getCellRangeByName("B1").Annotation.String = "My
Comment"
    ReplaceRangeFormulas(oRange, "=A1")
End Sub

with

Sub ReplaceRangeFormulas(oRange as Object, ReplaceValue)
Dim oRangeAddress as Object
Dim ColCount as Integer
Dim RowCount as Integer
Dim i as Integer
    oRangeAddress = oRange.RangeAddress
    ColCount = oRangeAddress.EndColumn - oRangeAddress.StartColumn
    RowCount = oRangeAddress.EndRow - oRangeAddress.StartRow
    Dim FillArray(RowCount) as Variant
    Dim sLine(ColCount) as Variant
    For i = 0 To ColCount
        sLine(i) = ReplaceValue
    Next i
    For i = 0 To RowCount
        FillArray(i) = sLine()
    Next i
    oRange.FormulaArray = FillArray()
End Sub 

then the Cell B1 only has the changed formula without the added note. 

The same holds true for "setValue" versa "setDataArray"

setFormulaArray() and setDataArray() should behave like setFormula() and
setValue() leaving the Annotation untouched.
Comment 1 berend.cornelius 2006-03-07 11:25:05 UTC
Set ParentTaskID
Comment 2 niklas.nebel 2006-07-14 18:11:37 UTC
changing target
Comment 3 Martin Hollmichel 2007-11-09 17:28:32 UTC
set target from 2.x to 3.x according to
http://wiki.services.openoffice.org/wiki/Target_3x
Comment 4 Marcus 2017-05-20 11:27:37 UTC
Reset assigne to the default "issues@openoffice.apache.org".