Diagonal borders in XLSX

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
bturcs
Posts: 23
Joined: Tue Nov 14, 2017 9:28 am

Diagonal borders in XLSX

Post by bturcs »

Are diagonal borders in XLSX currently working? Excel 2016 doesn't display them.

Stylesheet content generated by XLSSUIT6:

Code: Select all

        
         <border outline="0" >
            <diagonal>
                <color auto="1" />
            </diagonal>
        </border>
Stylesheet content generated by Excel:

Code: Select all

      <border diagonalDown="1">
         <diagonal style="dotted">
            <color auto="1" />
         </diagonal>
      </border>
Is it possible that the stylesheet attribute diagonaldown is missing?

Notes:
  • the xml styleheet code is shortened
  • the old DiagLines property from XLSSUIT4 is no longer available
  • I could add my delphi code if required
  • don't know where the outline attribute comes from, didn't set it in the code
I'm using CmdFormat to set diagonal borders.

Thank your for your help,
Basti
bturcs
Posts: 23
Joined: Tue Nov 14, 2017 9:28 am

Re: Diagonal borders in XLSX

Post by bturcs »

Here is the delphi code:

XLSSUIT6 (not working)

Code: Select all

procedure testd();
var
  LDoc: TXLSReadWriteII5;
  LFormat: TXLSCmdFormat;
begin
  try
    LDoc := TXLSReadWriteII5.Create(nil);
    LDoc.Sheets[0].AsString[3,3] := '';
    LFormat := LDoc.CmdFormat;
    LFormat.BeginEdit(LDoc[0]);
    LFormat.Border.Style := cbsThin;
    LFormat.Border.Color.TColor := $FF00FF;
    LFormat.Border.Side[cbsDiagLeft] := true;
    LFormat.Apply(3, 3);
    LDoc.Filename := 'C:\TEMP\DIAG.XLSX';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;
XLSSUIT4 (working)

Code: Select all

uses XlsReadWriteII4, CellFormats4, Cell4, SysUtils;

procedure testd();
var
  LDoc: TXLSReadWriteII4;
  LCell: TCell;
begin
  try
    LDoc := TXLSReadWriteII4.Create(nil);
    LDoc.Sheets[0].AsString[3,3] := '';
    LCell := LDoc.Sheets[0].Cell[3,3];
    LCell.BorderDiagStyle := cbsThin;
    LCell.BorderDiagLines := dlDown;
    LCell.BorderDiagColorRGB := $FF00FF;
    LDoc.Filename := 'C:\TEMP\DIAG.XLS';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;
end;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Diagonal borders in XLSX

Post by larsa »

Hello

Will fix this in the next update.
Lars Arvidsson, Axolot Data
bturcs
Posts: 23
Joined: Tue Nov 14, 2017 9:28 am

Re: Diagonal borders in XLSX

Post by bturcs »

We recently purchased the components (v 6.00.21, with source files). Can we receive the update or a patch too?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Diagonal borders in XLSX

Post by larsa »

Hello

This is fixed now. Please download the latest update.
Lars Arvidsson, Axolot Data
bturcs
Posts: 23
Joined: Tue Nov 14, 2017 9:28 am

Re: Diagonal borders in XLSX

Post by bturcs »

Thank your for the bug fix. I downloaded the latest version and now the diagonal border is showing up in the xlsx file. It does not work if I use the old file format, though.

Code: Select all

uses XlsReadWriteII5, XLSCmdFormat5, Xc12DataStyleSheet5, Xc12Utils5, SysUtils;

procedure testd();
var
  LDoc: TXLSReadWriteII5;
  LFormat: TXLSCmdFormat;
begin
  try
    LDoc := TXLSReadWriteII5.Create(nil);
    LDoc.Version := xvExcel97;
    LDoc.Sheets[0].AsString[3,3] := '';
    LFormat := LDoc.CmdFormat;
    LFormat.BeginEdit(LDoc[0]);
    LFormat.Border.Style := cbsThin;
    LFormat.Border.Color.TColor := $FF00FF;
    LFormat.Border.Side[cbsDiagLeft] := true;
    LFormat.Apply(3, 3);
    LDoc.Filename := 'C:\TEMP\DIAG.XLS';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;
end;
No border is shown in Cell D4.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Diagonal borders in XLSX

Post by larsa »

Hello

This is fixed in update 6.00.24
Lars Arvidsson, Axolot Data
bturcs
Posts: 23
Joined: Tue Nov 14, 2017 9:28 am

Re: Diagonal borders in XLSX

Post by bturcs »

I can confirm that it is working now for both filetypes, xls and xlsx. Thank you!
Post Reply