fpspreadsheet: xlsx reader support chart background/border as well as plotarea background/border. Beginning to log unsupported features.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9141 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
7d0e4ea426
commit
1025d9526f
@ -8,37 +8,17 @@ object Form1: TForm1
|
||||
ClientWidth = 1351
|
||||
LCLVersion = '3.99.0.0'
|
||||
OnCreate = FormCreate
|
||||
object sWorksheetGrid1: TsWorksheetGrid
|
||||
Left = 0
|
||||
Height = 489
|
||||
Top = 38
|
||||
Width = 563
|
||||
FrozenCols = 0
|
||||
FrozenRows = 0
|
||||
PageBreakPen.Color = clBlue
|
||||
PageBreakPen.Style = psDash
|
||||
ReadFormulas = False
|
||||
TextOverflow = True
|
||||
WorkbookSource = sWorkbookSource1
|
||||
Align = alLeft
|
||||
AutoAdvance = aaDown
|
||||
Color = clWhite
|
||||
DefaultColWidth = 64
|
||||
DefaultRowHeight = 22
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 563
|
||||
Left = 523
|
||||
Height = 489
|
||||
Top = 38
|
||||
Width = 5
|
||||
end
|
||||
object Chart1: TChart
|
||||
Left = 568
|
||||
Left = 528
|
||||
Height = 489
|
||||
Top = 38
|
||||
Width = 783
|
||||
Width = 823
|
||||
AxisList = <
|
||||
item
|
||||
Marks.LabelBrush.Style = bsClear
|
||||
@ -68,7 +48,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 38
|
||||
ClientWidth = 1351
|
||||
TabOrder = 3
|
||||
TabOrder = 2
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
@ -165,11 +145,51 @@ object Form1: TForm1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Height = 489
|
||||
Top = 38
|
||||
Width = 523
|
||||
Align = alLeft
|
||||
Caption = 'Panel2'
|
||||
ClientHeight = 489
|
||||
ClientWidth = 523
|
||||
TabOrder = 3
|
||||
object sWorksheetGrid1: TsWorksheetGrid
|
||||
Left = 1
|
||||
Height = 375
|
||||
Top = 1
|
||||
Width = 521
|
||||
FrozenCols = 0
|
||||
FrozenRows = 0
|
||||
PageBreakPen.Color = clBlue
|
||||
PageBreakPen.Style = psDash
|
||||
ReadFormulas = False
|
||||
TextOverflow = True
|
||||
WorkbookSource = sWorkbookSource1
|
||||
Align = alClient
|
||||
AutoAdvance = aaDown
|
||||
Color = clWhite
|
||||
DefaultColWidth = 64
|
||||
DefaultRowHeight = 22
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 1
|
||||
Height = 112
|
||||
Top = 376
|
||||
Width = 521
|
||||
Align = alBottom
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object sWorkbookSource1: TsWorkbookSource
|
||||
FileFormat = sfUser
|
||||
Options = []
|
||||
Left = 244
|
||||
Top = 138
|
||||
OnError = sWorkbookSource1Error
|
||||
Left = 176
|
||||
Top = 152
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
DefaultExt = '.ods'
|
||||
|
@ -22,8 +22,10 @@ type
|
||||
ComboBox1: TComboBox;
|
||||
Label1: TLabel;
|
||||
ListChartSource1: TListChartSource;
|
||||
Memo1: TMemo;
|
||||
OpenDialog1: TOpenDialog;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
Splitter1: TSplitter;
|
||||
sWorkbookSource1: TsWorkbookSource;
|
||||
sWorksheetGrid1: TsWorksheetGrid;
|
||||
@ -31,6 +33,7 @@ type
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure ComboBox1CloseUp(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure sWorkbookSource1Error(Sender: TObject; const AMsg: String);
|
||||
private
|
||||
sChartLink: TsWorkbookChartLink;
|
||||
procedure LoadFile(AFileName: String);
|
||||
@ -88,12 +91,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.sWorkbookSource1Error(Sender: TObject; const AMsg: String);
|
||||
begin
|
||||
Memo1.Lines.Add(AMsg);
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadFile(AFileName: String);
|
||||
var
|
||||
ext: String;
|
||||
fn: String;
|
||||
i: Integer;
|
||||
begin
|
||||
Memo1.Lines.Clear;
|
||||
|
||||
fn := ExpandFileName(AFileName);
|
||||
if not FileExists(fn) then
|
||||
begin
|
||||
|
@ -940,6 +940,8 @@ begin
|
||||
ReadChartLineSeries(workNode.FirstChild, AChart);
|
||||
'c:scatterChart':
|
||||
ReadChartScatterSeries(workNode.FirstChild, AChart);
|
||||
'c:spPr':
|
||||
ReadChartFillAndLineProps(workNode.FirstChild, AChart, AChart.PlotArea.Background, AChart.PlotArea.Border);
|
||||
end;
|
||||
workNode := workNode.NextSibling;
|
||||
end;
|
||||
@ -1041,6 +1043,7 @@ end;
|
||||
procedure TsSpreadOOXMLChartReader.ReadChartSeriesErrorBars(ANode: TDOMNode;
|
||||
ASeries: TsChartSeries);
|
||||
var
|
||||
workbook: TsWorkbook;
|
||||
nodeName, s: String;
|
||||
node: TDOMNode;
|
||||
val: Double;
|
||||
@ -1050,6 +1053,8 @@ begin
|
||||
if ANode = nil then
|
||||
exit;
|
||||
|
||||
workbook := TsSpreadOOXMLReader(Reader).Workbook as TsWorkbook;
|
||||
|
||||
// We must first find out whether the node is for x or y error bars and
|
||||
// whether it is for positive, negative or both error parts.
|
||||
node := ANode;
|
||||
@ -1084,11 +1089,22 @@ begin
|
||||
case nodeName of
|
||||
'c:errValType':
|
||||
case s of
|
||||
'fixedVal': errorBars.Kind := cebkConstant;
|
||||
'percentage': errorBars.Kind := cebkPercentage;
|
||||
'cust': errorBars.Kind := cebkCellRange;
|
||||
'stdDev': errorBars.Visible := false; // not supported
|
||||
'stdErr': errorBars.Visible := false; // not supported
|
||||
'fixedVal':
|
||||
errorBars.Kind := cebkConstant;
|
||||
'percentage':
|
||||
errorBars.Kind := cebkPercentage;
|
||||
'cust':
|
||||
errorBars.Kind := cebkCellRange;
|
||||
'stdDev':
|
||||
begin
|
||||
errorBars.Visible := false;
|
||||
workbook.AddErrorMsg('Error bar kind "stdDev" not supported');
|
||||
end;
|
||||
'stdErr':
|
||||
begin
|
||||
errorBars.Visible := false;
|
||||
workbook.AddErrorMsg('Error bar kind "stdErr" not supported.');
|
||||
end;
|
||||
end;
|
||||
'c:val':
|
||||
if (s <> '') and TryStrToFloat(s, val, FPointSeparatorSettings) then
|
||||
@ -1480,6 +1496,8 @@ var
|
||||
lReader: TsSpreadOOXMLReader;
|
||||
xmlStream: TStream;
|
||||
doc: TXMLDocument = nil;
|
||||
node: TDOMNode;
|
||||
nodeName: String;
|
||||
begin
|
||||
lReader := TsSpreadOOXMLReader(Reader);
|
||||
|
||||
@ -1488,7 +1506,18 @@ begin
|
||||
if UnzipToStream(AStream, AChartXML, xmlStream) then
|
||||
begin
|
||||
lReader.ReadXMLStream(doc, xmlStream);
|
||||
ReadChart(doc.DocumentElement.FindNode('c:chart'), AChart);
|
||||
node := doc.DocumentElement.FirstChild; //FindNode('c:chart');
|
||||
while Assigned(node) do
|
||||
begin
|
||||
nodeName := node.NodeName;
|
||||
case nodeName of
|
||||
'c:chart':
|
||||
ReadChart(node, AChart);
|
||||
'c:spPr':
|
||||
ReadChartFillAndLineProps(node.FirstChild, AChart, AChart.Background, AChart.Border);
|
||||
end;
|
||||
node := node.NextSibling;
|
||||
end;
|
||||
FreeAndNil(doc);
|
||||
end;
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user