Recent

Author Topic: New fpspreadsheet release 1.6  (Read 8914 times)

wp

  • Hero Member
  • *****
  • Posts: 13353
New fpspreadsheet release 1.6
« on: June 28, 2015, 02:28:44 pm »
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 fractions
  • Improved 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 cells
  • Page 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

  • Hero Member
  • *****
  • Posts: 1454
Re: New fpspreadsheet release 1.6
« Reply #1 on: June 28, 2015, 04:48:20 pm »
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\fpspreadsheet\fpspreadsheetgrid.pas(359,30) Error: No property found to override
P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadsheetgrid.pas(359,38) Error: Property cannot have a default value
P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadsheetgrid.pas(359,46) Error: Identifier not found "rsmMulti"
P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadsheetgrid.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
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

wp

  • Hero Member
  • *****
  • Posts: 13353
Re: New fpspreadsheet release 1.6
« Reply #2 on: June 28, 2015, 05:24:14 pm »
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

  • Hero Member
  • *****
  • Posts: 1454
Re: New fpspreadsheet release 1.6
« Reply #3 on: June 28, 2015, 06:39:12 pm »
Hi
I activated that
now I get
P:\My_Projects_and_Components\My_Components\fpspreadsheet\fpspreadsheet.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}           


The best way to get accurate information on the forum is to post something wrong and wait for corrections.

wp

  • Hero Member
  • *****
  • Posts: 13353
Re: New fpspreadsheet release 1.6
« Reply #4 on: June 28, 2015, 07:49:11 pm »
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][+][-]
  1. {------------------------------------------------------------------------------}
  2. {                 Central definition of conditional defines                    }
  3. {------------------------------------------------------------------------------}
  4.  
  5. { In Unix systems, the unit clocale is automatically added to the uses clause
  6.   of fpspreadsheet.pas. This unit sets up localization settings needed for
  7.   locale-dependent number and date/time formats. However, this adds a dependence
  8.   on the C library to the package.
  9.   If this is not wanted, define FPS_DONT_USE_CLOCALE. }
  10. {.$DEFINE FPS_DONT_USE_CLOCALE}
  11.  
  12. { In older versions of fpspreadsheet, the formatting fields had belonged to the
  13.   cell record. This has been given up to reduce memory consumption.
  14.   For fpc >2.6, however, record helpers allow to get this feature back. In case
  15.   of older compilers activate the define FPS_NO_RECORD_HELPERS. Note that worksheet
  16.   methods can only be used to change cell formatting then. }
  17. {.$DEFINE FPS_NO_RECORD_HELPERS}
  18.  
  19. {------------------------------------------------------------------------------}
  20.  
  21. { The next defines activate code duplicated from new compiler versions in case
  22.   an old compiler is used. }
  23.  
  24. { fpspreadsheet requires the function VarIsBool which was introduced by
  25.   fpc 2.6.4. If an older FPC versions is used define FPS_VARISBOOL. Keep
  26.   undefined for the current FPC version. }
  27. {.$DEFINE FPS_VARISBOOL}
  28.  
  29. { fpspreadsheet requires some functions from LazUTF8 which were
  30.   introduced by Lazarus 1.2. If an older Lazarus version is used define
  31.   FPS_LAZUTF8. Keep undefined for the current Lazarus version. }
  32. {.$DEFINE FPS_LAZUTF8}
  33.  
  34. { In order to allow selection of multiple ranges in the WorksheetGrid a
  35.   sufficiently new version of the basic TCustomGrid is required. The required
  36.   property "RangeSelect" was introduced in Lazarus 1.4. In order to compile
  37.   the package with older versions activate the define FPS_NO_GRID_MULTISELECT }
  38. {$DEFINE FPS_NO_GRID_MULTISELECT}
  39.  
« Last Edit: June 28, 2015, 08:00:08 pm by wp »

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: New fpspreadsheet release 1.6
« Reply #5 on: June 28, 2015, 08:00:16 pm »
:-[
Oops must have done something wrong.
All installed will do some testing.

Cheers
Josh
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

jmg

  • New Member
  • *
  • Posts: 33
Re: New fpspreadsheet release 1.6
« Reply #6 on: September 16, 2015, 10:16:24 am »
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

  • Hero Member
  • *****
  • Posts: 1568
Re: New fpspreadsheet release 1.6
« Reply #7 on: September 16, 2015, 10:27:17 am »
Best regards / Pozdrawiam
paweld

jmg

  • New Member
  • *
  • Posts: 33
Re: New fpspreadsheet release 1.6
« Reply #8 on: September 16, 2015, 11:45:42 am »
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

  • Hero Member
  • *****
  • Posts: 13353
Re: New fpspreadsheet release 1.6
« Reply #9 on: September 16, 2015, 12:01:46 pm »
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

  • New Member
  • *
  • Posts: 33
Re: New fpspreadsheet release 1.6
« Reply #10 on: September 16, 2015, 12:29:35 pm »
 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

  • New Member
  • *
  • Posts: 33
Re: New fpspreadsheet release 1.6
« Reply #11 on: September 17, 2015, 02:19:56 am »
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

  • Hero Member
  • *****
  • Posts: 13353
Re: New fpspreadsheet release 1.6
« Reply #12 on: September 17, 2015, 03:09:08 pm »
A gdb issue?

 

TinyPortal © 2005-2018