Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
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 7 Dec '12 - 19:54


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
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 398
1 Arun Vasu 381
2 OriginalGriff 345
3 Aarti Meswania 210
4 Maciej Los 196
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,559
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 8 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid