Excel Cell Alignments: Numerical values for e.g. xlLeft, xlRight or xlCenter?

后端 未结 3 487
广开言路
广开言路 2021-02-08 16:05

I\'ve been trying to align Excel cell text values. I\'ve tried the more common xlLeft, xlRight but this doesn\'t seem to work. The error was xlLe

相关标签:
3条回答
  • 2021-02-08 16:37

    You can use xlLeft:

    Imports Microsoft.Office.Interop.Excel
    
    ...
    oSheet.Range("A1").HorizontalAlignment = Constants.xlLeft
    
    0 讨论(0)
  • 2021-02-08 16:53

    For VerticalAlignment:

    Top:    -4160
    Center: -4108
    Bottom: -4107
    

    And HorizontalAlignment:

    Left:    -4131
    Center:  -4108
    Right:   -4152
    
    0 讨论(0)
  • 2021-02-08 16:57
    xcl.Range("J:J").EntireColumn.HorizontalAlignment = _
    Microsoft.Office.Interop.Excel.Constants.xlCenter
    
    0 讨论(0)
提交回复
热议问题