C1Excel Indenting

Posted by: gharshman on 25 October 2017, 6:03 pm EST

    • Post Options:
    • Link

    Posted 25 October 2017, 6:03 pm EST

    I am trying to indent a particular cell by one. When I sent the property to one for the cell, it is indenting all cells in the first column (A). In this worksheet, I have 39 rows, and each row is indented by one instead of just the one at the seventh index. What am I doing wrong?

    private static XLStyle sCellLeft

    var wb = new C1XLBook();

    XLSheet ws = wb.Sheets[0];

    sCellLeft = new XLStyle(wb);

    sCellLeft.AlignHorz = XLAlignHorzEnum.Left;

    sCellLeft.Font = new Font(“Calibri”, 11, FontStyle.Regular);

    ws[7, 0].Value = “Something”;

    ws[7, 0].Style = style;

    ws[7, 0].Style.Indent = 1;

  • Posted 26 October 2017, 1:48 am EST

    Hello,

    I could not replicate this issue at my end using the latest build. Please refer the attached sample.

    Could you please recheck the behavior with latest build which can be download from the following link

    http://prerelease.componentone.com/dotnet20/c1winforms/2017-t2/C1WinForms.2_2.0.20172.271.zip

    If the issue still exists, please share a stripped down sample replicating the problem. I would like to investigate this further

    Thanks,

    Mohit

    C1Excel_Indent.zip

  • Posted 26 October 2017, 5:19 pm EST

    Thank you. However, if you change the code to this:

    ws[6, 0].Value = “Something”;

    ws[6, 0].Style = sCellLeft;

    ws[6, 0].Style.Indent = 2;

    ws[7, 0].Value = “SomethingElse”;

    ws[7, 0].Style = sCellLeft;

    ws[7, 0].Style.Indent = 1;

    It will set all the indentation to the last one (1). I found a work around by creating separate styles for all the different indentations I am using.

  • Posted 27 October 2017, 12:46 am EST

    Hello,

    “Style” is a reference type property. Hence, whenever you change the value of this property, it changes the value of all its associated objects. So, you need to create separate styles for all the different indentations.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels