fpspreadsheet: xlsx writer supports rotated bar series.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9228 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-02-09 16:28:04 +00:00
parent e9e5b18ab3
commit e5087c7df6
5 changed files with 10 additions and 13 deletions

View File

@ -36,7 +36,7 @@ begin
for i := 1 to ParamCount do
case lowercase(ParamStr(i)) of
'horiz', 'horizontal':
'hor', 'horiz', 'horizontal':
rotated := true;
'vert', 'vertical', 'rotated':
rotated := false;

View File

@ -69,11 +69,6 @@
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>

View File

@ -157,6 +157,7 @@ object Form1: TForm1
ClientWidth = 523
TabOrder = 3
object sWorksheetGrid1: TsWorksheetGrid
Cursor = crSizeAll
Left = 1
Height = 375
Top = 1

View File

@ -121,7 +121,7 @@ procedure TForm1.ComboBox1CloseUp(Sender: TObject);
begin
if ComboBox1.ItemIndex > -1 then
begin
Combobox1.Text := FDir + Combobox1.Items[Combobox1.ItemIndex];
Combobox1.Text := FDir + Combobox1.Items[Combobox1.ItemIndex];
LoadFile(Combobox1.Text);
end;
end;

View File

@ -163,7 +163,7 @@ const
DEFAULT_FONT_NAME = 'Liberation Sans';
AX_POS: array[TsChartAxisAlignment] of string = ('l', 't', 'r', 'b');
AX_POS: array[boolean, TsChartAxisAlignment] of string = ( ('l', 't', 'r', 'b'), ('b', 'r', 't', 'l') );
FALSE_TRUE: Array[boolean] of Byte = (0, 1);
LEGEND_POS: Array[TsChartLegendPosition] of string = ('r', 't', 'b', 'l');
TRENDLINE_TYPES: Array[TsTrendlineType] of string = ('', 'linear', 'log', 'exp', 'power', 'poly');
@ -3446,7 +3446,8 @@ end;
procedure TsSpreadOOXMLChartWriter.WriteBarSeries(AStream: TStream;
AIndent: Integer; ASeries: TsBarSeries; ASeriesIndex: Integer);
const
GROUPING: Array[TsChartStackMode] of string = ('clustered', 'stacked', 'percentStacked');
BAR_DIR: array[boolean] of string = ('col', 'bar');
GROUPING: array[TsChartStackMode] of string = ('clustered', 'stacked', 'percentStacked');
var
indent: String;
chart: TsChart;
@ -3471,10 +3472,10 @@ begin
if isFirstOfGroup then
AppendToStream(AStream, Format(
indent + '<c:barChart>' + LE +
indent + ' <c:barDir val="col"/>' + LE +
indent + ' <c:barDir val="%s"/>' + LE +
indent + ' <c:varyColors val="0"/>' + LE +
indent + ' <c:grouping val="%s"/>' + LE,
[ GROUPING[chart.StackMode] ]
[ BAR_DIR[chart.RotatedAxes], GROUPING[chart.StackMode] ]
));
WriteChartSeriesNode(AStream, AIndent + 2, ASeries, ASeriesIndex);
@ -3595,7 +3596,6 @@ var
axID: DWord;
rotAxID: DWord;
crosses: String = 'autoZero';
logarithmic: String = '';
begin
indent := DupeString(' ', AIndent);
@ -3615,7 +3615,8 @@ begin
AppendToStream(AStream, Format(
indent + ' <c:delete val="0"/>' + LE +
indent + ' <c:axPos val="%s" />' + LE,
[ AX_POS[Axis.Alignment] ]
[ AX_POS[Axis.Chart.RotatedAxes, Axis.Alignment] ]
// axis rotation seems to be respected by Excel only for bar series.
));
// Grid lines