text
stringlengths
0
234
WriteFmtStr(xl, "#\ ?/?");
end if;
when fraction_2 =>
if xl.format >= BIFF3 then
WriteFmtStr(xl, "#\ ??/??");
end if;
when dd_mm_yyyy => WriteFmtStr(xl, "dd/mm/yyyy");
when dd_mmm_yy => WriteFmtStr(xl, "dd/mmm/yy");
when dd_mmm => WriteFmtStr(xl, "dd/mmm");
when mmm_yy => WriteFmtStr(xl, "mmm/yy");
when h_mm_AM_PM => WriteFmtStr(xl, "h:mm\ AM/PM");
when h_mm_ss_AM_PM => WriteFmtStr(xl, "h:mm:ss\ AM/PM");
when hh_mm => WriteFmtStr(xl, "hh:mm");
when hh_mm_ss => WriteFmtStr(xl, "hh:mm:ss");
when dd_mm_yyyy_hh_mm => WriteFmtStr(xl, "dd/mm/yyyy\ hh:mm");
when percent_0_plus =>
WriteFmtStr(xl, "+0%;-0%;0%");
when percent_2_plus =>
WriteFmtStr(xl, "+0" & sep_deci & "00%;-0" & sep_deci & "00%;0" & sep_deci & "00%");
when date_iso => WriteFmtStr(xl, "yyyy\-mm\-dd");
when date_h_m_iso => WriteFmtStr(xl, "yyyy\-mm\-dd\ hh:mm");
when date_h_m_s_iso => WriteFmtStr(xl, "yyyy\-mm\-dd\ hh:mm:ss");
-- !! Trouble: Excel (German Excel/French locale) writes yyyy, reads it,
-- understands it and translates it into aaaa, but is unable to
-- understand *our* yyyy
-- Same issue as [Red] vs [Rot] above.
end case;
end loop;
-- ^ Some formats in the original list caused problems, probably
-- because of regional placeholder symbols
case xl.format is
when BIFF2 =>
for i in 1..6 loop
WriteFmtStr(xl, "@");
end loop;
when BIFF3 =>
for i in 1..4 loop
WriteFmtStr(xl, "@");
end loop;
when BIFF4 =>
null;
end case;
-- ^ Stuffing for having the same number of built-in and EW custom
end WriteFmtRecords;
-- 5.35 DIMENSION
procedure Write_Dimensions(xl: Excel_Out_Stream'Class) is
-- sheet bounds: 0 2 Index to first used row
-- 2 2 Index to last used row, increased by 1
-- 4 2 Index to first used column
-- 6 2 Index to last used column, increased by 1
--
-- Since our row / column counts are 1-based, no need to increase by 1.
sheet_bounds: constant Byte_buffer:=
Intel_16(0) &
Intel_16(Unsigned_16(xl.maxrow)) &
Intel_16(0) &
Intel_16(Unsigned_16(xl.maxcolumn));
-- sheet_bounds_32_16: constant Byte_buffer:=
-- Intel_32(0) &
-- Intel_32(Unsigned_32(xl.maxrow)) &
-- Intel_16(0) &
-- Intel_16(Unsigned_16(xl.maxcolumn));
begin
case xl.format is
when BIFF2 =>
WriteBiff(xl, 16#0000#, sheet_bounds);
when BIFF3 | BIFF4 =>
WriteBiff(xl, 16#0200#, sheet_bounds & (0,0));
-- when BIFF8 =>
-- WriteBiff(xl, 16#0200#, sheet_bounds_32_16 & (0,0));
end case;
end Write_Dimensions;
procedure Define_number_format(
xl : in out Excel_Out_Stream;
format : out Number_format_type;
format_string: in String
)
is
begin
xl.number_fmt:= xl.number_fmt + 1;
format:= xl.number_fmt;
WriteFmtStr(xl, format_string);
end Define_number_format;
procedure Write_Worksheet_header(xl : in out Excel_Out_Stream'Class) is
procedure Define_style(fmt: Format_type; style_id: Unsigned_8) is
Base_Level: constant:= 255;
begin
WriteBiff(xl,
16#0293#,
Intel_16(Unsigned_16(fmt) + 16#8000#) & style_id & Base_Level
);
end Define_style;
--
Comma_Style : constant:= 3;
Currency_Style : constant:= 4;
Percent_Style : constant:= 5;