diff --git a/components/fpspreadsheet/examples/excel8demo/excel8write.lpi b/components/fpspreadsheet/examples/excel8demo/excel8write.lpi index a8b6f793b..6ab082e31 100644 --- a/components/fpspreadsheet/examples/excel8demo/excel8write.lpi +++ b/components/fpspreadsheet/examples/excel8demo/excel8write.lpi @@ -1,8 +1,8 @@ + - @@ -10,13 +10,15 @@ - <UseAppBundle Value="False"/> </General> <VersionInfo> - <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -43,12 +45,17 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="9"/> <PathDelim Value="\"/> <SearchPaths> - <OtherUnitFiles Value="..\"/> - <SrcPath Value="..\"/> + <OtherUnitFiles Value=".."/> + <SrcPath Value=".."/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> <CompilerPath Value="$(CompPath)"/> </Other> diff --git a/components/fpspreadsheet/examples/excel8demo/excel8write.lpr b/components/fpspreadsheet/examples/excel8demo/excel8write.lpr index c0bb8a39a..30a18bfb6 100644 --- a/components/fpspreadsheet/examples/excel8demo/excel8write.lpr +++ b/components/fpspreadsheet/examples/excel8demo/excel8write.lpr @@ -82,6 +82,7 @@ begin MyWorksheet.WriteUTF8Text(0, 2, Str_Third); MyWorksheet.WriteUTF8Text(0, 3, Str_Fourth); MyWorksheet.WriteTextRotation(0, 0, rt90DegreeClockwiseRotation); + MyWorksheet.WriteUsedFormatting(0, 1, [uffBold]); // Save the spreadsheet to a file MyWorkbook.WriteToFile(MyDir + 'test2.xls', sfExcel8, False); diff --git a/components/fpspreadsheet/examples/excel8demo/run_excel8write.bat b/components/fpspreadsheet/examples/excel8demo/run_excel8write.bat new file mode 100644 index 000000000..5d6acfa5f --- /dev/null +++ b/components/fpspreadsheet/examples/excel8demo/run_excel8write.bat @@ -0,0 +1,2 @@ +excel8write.exe +pause \ No newline at end of file diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index 71c97bb88..b10ee9d04 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -88,7 +88,7 @@ type {@@ List of possible formatting fields } - TsUsedFormattingField = (uffTextRotation); + TsUsedFormattingField = (uffTextRotation, uffBold); {@@ Describes which formatting fields are active } @@ -157,6 +157,7 @@ type procedure WriteFormula(ARow, ACol: Cardinal; AFormula: TsFormula); procedure WriteRPNFormula(ARow, ACol: Cardinal; AFormula: TsRPNFormula); procedure WriteTextRotation(ARow, ACol: Cardinal; ARotation: TsTextRotation); + procedure WriteUsedFormatting(ARow, ACol: Cardinal; AUsedFormatting: TsUsedFormattingFields); property Cells: TAVLTree read FCells; end; @@ -657,6 +658,16 @@ begin ACell^.TextRotation := ARotation; end; +procedure TsWorksheet.WriteUsedFormatting(ARow, ACol: Cardinal; + AUsedFormatting: TsUsedFormattingFields); +var + ACell: PCell; +begin + ACell := GetCell(ARow, ACol); + + ACell^.UsedFormattingFields := AUsedFormatting; +end; + { TsWorkbook } {@@ diff --git a/components/fpspreadsheet/xlsbiff8.pas b/components/fpspreadsheet/xlsbiff8.pas index e49dd3045..11816a85c 100755 --- a/components/fpspreadsheet/xlsbiff8.pas +++ b/components/fpspreadsheet/xlsbiff8.pas @@ -168,6 +168,7 @@ const { FONT record constants } INT_FONT_WEIGHT_NORMAL = $0190; + INT_FONT_WEIGHT_BOLD = $02BC; { FORMULA record constants } MASK_FORMULA_RECALCULATE_ALWAYS = $0001; @@ -306,10 +307,12 @@ begin try FontData.Name := 'Arial'; - // FONT0 + // FONT0 - normal WriteFont(AStream, FontData); - // FONT1 + // FONT1 - bold + FontData.Bold := True; WriteFont(AStream, FontData); + FontData.Bold := False; // FONT2 WriteFont(AStream, FontData); // FONT3 @@ -356,6 +359,8 @@ begin WriteXF(AStream, 0, 0, XF_ROTATION_90_DEGREE_COUNTERCLOCKWISE); // XF17 WriteXF(AStream, 0, 0, XF_ROTATION_90_DEGREE_CLOCKWISE); + // XF18 + WriteXF(AStream, 1, 0, XF_ROTATION_HORIZONTAL); WriteStyle(AStream); @@ -546,13 +551,15 @@ begin AStream.WriteWord(WordToLE(200)); { Option flags } - AStream.WriteWord(WordToLE(0)); + if AFont.Bold then AStream.WriteWord(WordToLE(1)) + else AStream.WriteWord(WordToLE(0)); { Colour index } AStream.WriteWord(WordToLE($7FFF)); { Font weight } - AStream.WriteWord(WordToLE(INT_FONT_WEIGHT_NORMAL)); + if AFont.Bold then AStream.WriteWord(WordToLE(INT_FONT_WEIGHT_BOLD)) + else AStream.WriteWord(WordToLE(INT_FONT_WEIGHT_NORMAL)); { Escapement type } AStream.WriteWord(WordToLE(0)); @@ -742,6 +749,10 @@ begin AStream.WriteWord(WordToLE(15)); end; end + else if ACell^.UsedFormattingFields = [uffBold] then + begin + AStream.WriteWord(WordToLE(18)); + end else AStream.WriteWord(WordToLE(15));