Left Aligning CellType.NumberCellType

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

  • Posted 8 September 2017, 2:51 pm EST

    <p>I have defined a cell type as NumberCellType as follows:</p><p>        Dim nbrCT As FarPoint.Win.Spread.CellType.NumberCellType = New FarPoint.Win.Spread.CellType.NumberCellType</p><p>        nbrCT.DecimalPlaces = 0</p><p>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:</p><p>  <span class="Apple-tab-span" style="white-space:pre;"> </span>fpsProperties.ActiveSheet.Columns(grdGlobalChgCol).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left</p><p>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?</p><p>Thanks </p><p>Rodney </p>
  • Replied 8 September 2017, 2:51 pm EST

    <p>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.</p><p> </p><p>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.  </p><p>I tried setting the justification in two places:</p><p>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.</p>
  • Replied 8 September 2017, 2:51 pm EST

    <p>Hello,</p><p>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. </p><p>Thanks,</p><p>Manpreet Kaur. <br></p>
  • 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

    <p>Hello,</p><p>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.</p><p>Thanks,</p><p>Manpreet Kaur. <br></p>
  • Replied 8 September 2017, 2:51 pm EST

    <p>Just thought I would let you know I got it fixed.  </p><p>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.</p><p>Thanks so much.</p><p>Rodney </p>
  • Replied 8 September 2017, 2:51 pm EST

    <p>Rodney,</p><p>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:</p><p> <br>            FarPoint.Win.Spread.CellType.NumberCellType nmbrcell = new FarPoint.Win.Spread.CellType.NumberCellType();         
    <br>            nmbrcell.DecimalPlaces = 5;                  
    <br>            fpSpread1.ActiveSheet.Columns[1].CellType = nmbrcell;             
    <br>            fpSpread1.ActiveSheet.Columns[1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; </p><p> </p><p>I am using Spread v6 to test this. Could you please provide me sample application to debug this further? <br></p><p> </p><p>Thanks,</p><p> </p><p> </p><p> </p>
Need extra support?

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

Learn More

Forum Channels