New fpspreadsheet release 1.6 lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- wp · 2015-06-28 12:28 It is time for a new release of FPSpreadsheet... The new version 1.6 is available for download from https://sourceforge.net/projects/lazarus-ccr/files/FPSpreadsheet/. Besides a lot of bug fixes, it offers the following new features Major reconstruction of the cell record resulting in drastic reduction of memory consumption per cell by about a factor 4. Most of this has been achieved by moving the cell formatting data from the TCell record to a shared format list in the workbook.Implementation of a record helper for TCell which simplifies cell formatting . In this way, format properties can still be accessed from the cell although the cell does not store them any more. Moreover, there is no need to set a bit in UsedFormattingFields,  and visual controls are automatically notified of cell changes. Add unit fpscell to "uses" to get access to these features.Enumerators for worksheet's internal AVLTrees for faster iteration using a for-in loop. Improved number format parser for better recognition of Excel-like number formats. Formatting of numbers as fractionsImproved color management: no more palettes, but direct rgb colors. More pre-defined colors covering the built-in Excel biff8 color range. Background fill patterns Comments in cells Hyperlinks in cellsPage layout (page margins, headers, footer, used for only when printing in the Office applications - however, there is no direct printing support in fpspreadsheet!) TsWorkbookChartSource is a new component which facilitates creation of charts from non- contiguous cells in different worksheets. It interfaces to a workbook via the WorkbookSource component. In the long run, it will replace the older TsWorksheetChartSource which required contiguous x/y data blocks in the same worksheet and has been tagged as deprecated. An offline version of all wiki pages related to FPSpreadsheet is included in file set as a chm help file.Absolute compatibility with previous versions had to be given up at a few places. Here is a list of the changes that may break existing code: All type declarations and constants are moved from fpspreadsheet.pas to the new unit fpstypes.pas. Therefore, most probably, this unit has to be added to the uses clause of every existing fpspreadsheet application.Because fpspreadsheet now supports background fill patterns the cell property BackgroundColor has been replaced by Background which stores also pattern type and pattern color. Correspondingly, the UsedFormattingFields flag uffBackgroundColor is called uffBackground now. Another UsedFormattingFields flag has been dropped: uffBold. It is from the early days of fpspreadsheet and has become obsolete after the introduction of full font support. For achieving a bold type-face, now call MyWorksheet.WriteFont(row, col, BOLD_FONTINDEX), or Myworksheet.WriteFontStyle(row, col, [fssBold]). Iteration through cells using the worksheet methods GetFirstCell and GetNextCell has been removed - it failed if another iteration of this kind was called within the loop. Use the new for-in syntax instead. Support for shared formulas has been reduced. The field SharedFormulaBase has been deleted from the TCell record, and methods related to shared formulas have been removed from TsWorksheet. Files containing shared formulas can still be read, the shared formulas are converted to multiple normal formulas. The color palettes of previous versions have been abandoned. TsColor is now a DWord representing the rgb components of a color (just like TColor does in the graphics unit), it is not an index into a color palette any more. The values of pre-defined colors, therefore, have changed, their names, however, are still existing. The workbook functions for palette access are obsolete now and were removed.Have fun. ---------------------------------------------------------------------- Josh · 2015-06-28 14:48 Hi Tried to install and am getting a problem. I installed laz_fpspreadsheet which was fine However I tried to install laz_fpspreadsheet_visual, when I compile package I get error Code: [Select]P:\My_Projects_and_Components\My_Components\fpspreadshee t\fpspreadsheetgrid.pas(359,30) Error: No property found to override P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadshee tgrid.pas(359,38) Error: Property cannot have a default value P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadshee tgrid.pas(359,46) Error: Identifier not found "rsmMulti" P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadshee tgrid.pas(588,1) Fatal: There were 3 errors compiling module, stopping fpspreadsheetgrid.pas  line 357 Code: [Select] {$IFNDEF FPS_NO_GRID_MULTISELECT}     {@@ Allow multiple selections}     property RangeSelectMode default rsmMulti;    {$ENDIF} Hope you can follow that ---------------------------------------------------------------------- wp · 2015-06-28 15:24 Your Lazarus 1.3 is probably too old because the WorksheetGrid needs the property RangeSelectMode of the TCustomGrid which was added during the life time of 1.3. FPSpreadsheet, however, is prepared for this situation: Open the file fps.inc, activate the define FPS_NO_GRID_MULTISELECT and rebuild the package and/or Lazarus. ---------------------------------------------------------------------- Josh · 2015-06-28 16:39 Hi I activated that now I get P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadshee t.pas(22,3) Fatal: Syntax error, "INTERFACE" expected but "identifier CLOCALE" found {$ifdef UNIX}{$ifndef DARWIN}{$ifndef FPS_DONT_USE_CLOCALE}   clocale,  {$endif}{$endif}{$endif} ---------------------------------------------------------------------- wp · 2015-06-28 17:49 No idea what you did wrong, I just checked with Laz 1.2 which is even older and this compile fine after the modification. Maybe something went wrong when you activated the define? You only have to remove the dot before the $DEFINE FPS_NO_GRID_MULTISELECT - nothing else. Here is the fps.inc file which should work in your case. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {---------- --------------------------------------------------------------------}{                 Central definition of conditional defines                  }{-------------------------------------------------------------- ----------------} { In Unix systems, the unit clocale is automatically added to the uses clause  of fpspreadsheet.pas. This unit sets up localization settings needed for  locale-dependent number and date/time formats. However, this adds a dependence  on the C library to the package.  If this is not wanted, define FPS_DONT_USE_CLOCALE. }{.$DEFINE FPS_DONT_USE_CLOCALE} { In older versions of fpspreadsheet, the formatting fields had belonged to the  cell record. This has been given up to reduce memory consumption.  For fpc >2.6, however, record helpers allow to get this feature back. In case  of older compilers activate the define FPS_NO_RECORD_HELPERS. Note that worksheet  methods can only be used to change cell formatting then. }{.$DEFINE FP S_NO_RECORD_HELPERS} {------------------------------------------------ ------------------------------} { The next defines activate code duplicated from new compiler versions in case  an old compiler is used. } { fpspreadsheet requires the function VarIsBool which was introduced by  fpc 2.6.4. If an older FPC versions is used define FPS_VARISBOOL. Keep  undefined for the current FPC version. }{.$DEFINE FPS_VARISBOOL} { fpspreadsheet requires some functions from LazUTF8 which were  introduced by Lazarus 1.2. If an older Lazarus version is used define  FPS_LAZUTF8. Keep undefined for the current Lazarus version. }{.$DEFINE FPS_LAZUTF8} { In order to allow selection of multiple ranges in the WorksheetGrid a  sufficiently new version of the basic TCustomGrid is required. The required  property "RangeSelect" was introduced in Lazarus 1.4. In order to compile  the package with older versions activate the define FPS_NO_GRID_MULTISELECT }{$DEFINE FPS_NO_GRID_MULTISELECT} ---------------------------------------------------------------------- Josh · 2015-06-28 18:00 Oops must have done something wrong. All installed will do some testing. Cheers Josh ---------------------------------------------------------------------- jmg · 2015-09-16 08:16 Following also this thread http://forum.lazarus.freepascal.org/index.php/topic,27805.0.html I am trying to find the latest version of FloatToFraction in fpsutils.pas, but I'm confused about what is the latest. I can find this http://sourceforge.net/p/lazarus-ccr/svn/4144/ and to me, the form of this procedure FloatToFraction(AValue, APrecision: Double;                          AMaxNumerator, AMaxDenominator: Int64;                          out ANumerator, ADenominator: Int64); seems to  give to most user control. Is that the latest, and where can I download it ? ---------------------------------------------------------------------- paweld · 2015-09-16 08:27 from SVN or: http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tarball ---------------------------------------------------------------------- jmg · 2015-09-16 09:45 Thanks, but when I download from  ..svn/HEAD/.. the fpsutils.pas has this header procedure FloatToFraction(AValue: Double; AMaxDenominator: Int64;   out ANumerator, ADenominator: Int64); which looks less useful than the header I gave above. Is this simpler header, really the newest release ? ---------------------------------------------------------------------- wp · 2015-09-16 10:01 svn-trunk is the latest release. Yes, the header was changed because controlling both denominator and numerator digits does not make sense for fpspreadsheet. If you need more control use Bart's fraction library which was the basis of the code used by fpspreadsheet: http:// svn.code.sf.net/p/flyingsheep/code/trunk/ConsoleProjecten/fractions/ ---------------------------------------------------------------------- jmg · 2015-09-16 10:29 Thanks , when I follow that, the header is function FloatToFrac(F: Double; Precision: Double): TFraction; and I have that working from the other thread, but it seems to have less control than this procedure FloatToFraction(AValue, APrecision: Double;                          AMaxNumerator, AMaxDenominator: Int64;                          out ANumerator, ADenominator: Int64); but I think you are saying that header-related  code is now gone ? Mostly, I want to operate set fraction seek-depth by precision, but in some cases an upper limit on  Denominator is also useful to provide. ---------------------------------------------------------------------- jmg · 2015-09-17 00:19 In testing and debug of these various RealToFraction routines, I notice that const   MaxInt64 = High(Int64);   MinInt64 = Low(Int64); var   iMaxInt64 :Int64  = High(Int64);   iMinInt64 :Int64  = Low(Int64); do not give the same hover-watch values, but when I double check with a print and diff, the CONST ones are correct. ---------------------------------------------------------------------- wp · 2015-09-17 13:09 A gdb issue?