locked
Property or indexer 'Microsoft.Office.Interop.Excel.Range.Text' cannot be assigned it is a read only property RRS feed

  • Question

  • User2031860760 posted

    hello every1 i have to allign text in in all fields in a excel sheet....but actually some are right alligned and some are left allignt while i have not write any statement to do......while i am trying to allign it left its showing me the following error....

    sheet.Range["B7"].Text = "Left";
    sheet.Range["B7"].Style.HorizontalAlignment = HorizontalAlignType.Left;
    error:- Property or indexer 'Microsoft.Office.Interop.Excel.Range.Text' cannot be assigned it is a read only property
    
    
    thnx in advance guyzzz
    Friday, May 18, 2012 6:19 AM

Answers

  • User-760709272 posted

    Does this work?

    sheet.Range["B7"].FormulaR1C1 = "Left";

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 18, 2012 6:24 AM

All replies

  • User-760709272 posted

    Does this work?

    sheet.Range["B7"].FormulaR1C1 = "Left";

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 18, 2012 6:24 AM
  • User2031860760 posted

    thnx it works 4 me....thnx a lot....:)

    Friday, May 18, 2012 7:06 AM