Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Jul 10, 2020 11:47 am

Hi,

What is the code to set Cell Indent, as shown in the provided attachment?

Kind regards,
Perry
Attachments
Cell Indent.zip
Example for Indent
(6.27 KiB) Downloaded 161 times

p.meertens
 
Posts: 8
Joined: Tue Sep 23, 2014 8:41 pm

Mon Jul 13, 2020 3:21 am

Hello,

Sorry for the late reply as weekend.
Please refer to the following code to achieve your needs. If you have further questions, please feel free to contact us!
Code: Select all
            Workbook wb = new Workbook();
            Worksheet sheet = wb.Worksheets[0];
            sheet.Range["A1"].Value = "Line1";
            sheet.Range["A1"].Style.HorizontalAlignment = HorizontalAlignType.Left;
            sheet.Range["A1"].Style.IndentLevel = 0;
            sheet.Range["A2"].Value = "Line2";
            sheet.Range["A2"].Style.HorizontalAlignment = HorizontalAlignType.Left;
            sheet.Range["A2"].Style.IndentLevel = 1;
            sheet.Range["A3"].Value = "Line3";
            sheet.Range["A3"].Style.HorizontalAlignment = HorizontalAlignType.Left;
            sheet.Range["A3"].Style.IndentLevel = 2;
            sheet.Range["A4"].Value = "Line4";
            sheet.Range["A4"].Style.HorizontalAlignment = HorizontalAlignType.Left;
            sheet.Range["A4"].Style.IndentLevel = 3;
            wb.SaveToFile("out.xlsx", FileFormat.Version2013);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Jul 16, 2020 8:43 pm

Hi Rachel,

Thank you for your solution!

Kind regards,
Perry

p.meertens
 
Posts: 8
Joined: Tue Sep 23, 2014 8:41 pm

Fri Jul 17, 2020 1:12 am

Hi Perry,

Thanks for your response.
If you encounter any issues related to our product, just feel free to contact us.
Have a nice day!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.XLS