Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi I Use DCOM Excel component for export my data to Excel . but I face to 2 problems:
1- How can I set align of a text in a cell ? set it to right , left or center. For example worksheet.cell[1,2].align = “right”;
2- Suppose Contains of a cell is a number . I wants to separate it’s digits by separator (3 digits by 3 digits) for example : 34567898 to 34,567,898
Thanks very much
Posted

1 solution

worksheet.Cells[1, 2].HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;

and I think the answer to the 2nd bit is

worksheet.Cells[1, 2].Style = "Comma" - if not then try the CellFormat.NumberFormat property on the cell
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900