Left Aligning CellType.NumberCellType

Posted by: rodneybuxton on 8 September 2017, 2:51 pm EST

  • Posted 8 September 2017, 2:51 pm EST

    I have defined a cell type as NumberCellType as follows:

            Dim nbrCT As FarPoint.Win.Spread.CellType.NumberCellType = New FarPoint.Win.Spread.CellType.NumberCellType

            nbrCT.DecimalPlaces = 0

    For some reason the user wants all the numbers to be left justified.  I want it to remain a number cell for editing purposes.  I tried using:

       fpsProperties.ActiveSheet.Columns(grdGlobalChgCol).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left

    to set the column to left justified, but it seems to just ignore the setting.  Any ideas on what I'm doing wrong?  Is it possible to do this?  Am I doing something wrong?

    Thanks 

    Rodney 

  • Replied 8 September 2017, 2:51 pm EST

    I'm not sure that is going to work.  The data is being loaded from database files that you would are off of a server side application etc.  I can send the code, but I it wont run for you.

     

    We define the cells data types individually based on the data being read in so some are text and some are numeric the whole column isn't numeric, but I want the whole column left justified.  

    I tried setting the justification in two places:

    loadQueryGrid() and  initializeQueryGrid() in the frmINIOptions, the code is commented out right now.  But you can see where it is.  I've attached the code.


    2012/01/MQROptions.zip
  • Replied 8 September 2017, 2:51 pm EST

    Hello,

    I was not able to replicate the issue at my end. I have attached a sample that depicts the correct working of HorizontalAlignment property. I have also attached the screenshots of the output. Kindly have a look at it and let me know, apart from the database what is the difference in the code used by you.

    Thanks,

    Manpreet Kaur.


    2012/01/sample.zip
  • Replied 8 September 2017, 2:51 pm EST

    So basically after you load all the date into the sheet you are apply the HorizonatalAlignment property?
  • Replied 8 September 2017, 2:51 pm EST

    Hello,

    I would like you to know, that it does not really matter whether the alignment is set before the data is loaded into Spread or after the data is loaded into Spread. I have attached a sample that depicts the same, in which initially the HorizontalAlignment property is set and later the data is loaded into Spread by binding it to a database and even the celltypes are changed, but it does not affect the alignment settings in anyway.

    Thanks,

    Manpreet Kaur.


    2012/01/alignnumbercellleft.zip
  • Replied 8 September 2017, 2:51 pm EST

    Just thought I would let you know I got it fixed.  

    Although it did seem to matter that I was doing it after I loaded my data.  Not sure why.  But I'm not going to worry about it.  It is left aligned now and my user is happy.

    Thanks so much.

    Rodney 

  • Replied 8 September 2017, 2:51 pm EST

    Rodney,

    I am having no issues setting the cell 's horizontal alignment to left. I am setting the cell type for a whole column and also setting it's horizontal alignment to left using the code as follows:

     
                FarPoint.Win.Spread.CellType.NumberCellType nmbrcell = new FarPoint.Win.Spread.CellType.NumberCellType();         

                nmbrcell.DecimalPlaces = 5;                  

                fpSpread1.ActiveSheet.Columns[1].CellType = nmbrcell;             

                fpSpread1.ActiveSheet.Columns[1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;

     

    I am using Spread v6 to test this. Could you please provide me sample application to debug this further?

     

    Thanks,

     

     

     

Need extra support?

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

Learn More

Forum Channels