text
stringlengths
0
234
for s in Font_style_single loop
if style(s) then
style_bits:= style_bits + mask;
end if;
mask:= mask * 2;
end loop;
xl.fonts:= xl.fonts + 1;
if xl.fonts = 4 then
xl.fonts:= 5;
-- Anomaly! The font with index 4 is omitted in all BIFF versions.
-- Numbering is 0, 1, 2, 3, *5*, 6,...
end if;
case xl.format is
when BIFF2 =>
WriteBiff(xl, 16#0031#,
Intel_16(Unsigned_16(height * y_scale)) &
Intel_16(style_bits) &
To_buf_8_bit_length(font_name)
);
if color /= automatic then
-- 5.47 FONTCOLOR
WriteBiff(xl, 16#0045#, Intel_16(color_code(BIFF2, color)(for_font)));
end if;
when BIFF3 | BIFF4 => -- BIFF8 has 16#0031#, p. 171
WriteBiff(xl, 16#0231#,
Intel_16(Unsigned_16(height * y_scale)) &
Intel_16(style_bits) &
Intel_16(color_code(BIFF3, color)(for_font)) &
To_buf_8_bit_length(font_name)
);
end case;
font:= Font_type(xl.fonts);
end Define_font;
procedure Jump_to_and_store_max(xl: in out Excel_Out_Stream; r, c: Integer) is
pragma Inline(Jump_to_and_store_max);
begin
if not xl.is_created then
raise Excel_stream_not_created;
end if;
Jump_to(xl, r, c); -- Store and check current position
if r > xl.maxrow then
xl.maxrow := r;
end if;
if c > xl.maxcolumn then
xl.maxcolumn := c;
end if;
end Jump_to_and_store_max;
-- 2.5.13 Cell Attributes (BIFF2 only)
function Cell_attributes(xl: Excel_Out_Stream) return Byte_buffer is
begin
return
(Unsigned_8(xl.xf_in_use),
Unsigned_8(xl.xf_def(xl.xf_in_use).numb) + 16#40# *
Unsigned_8(xl.xf_def(xl.xf_in_use).font),
0
);
end Cell_attributes;
function Almost_zero(x: Long_Float) return Boolean is
begin
return abs x <= Long_Float'Model_Small;
end Almost_zero;
-- Internal
--
-- 5.71 NUMBER
procedure Write_as_double (
xl : in out Excel_Out_Stream;
r,
c : Positive;
num : Long_Float
)
is
pragma Inline(Write_as_double);
begin
Jump_to_and_store_max(xl, r, c);
case xl.format is
when BIFF2 =>
WriteBiff(xl, 16#0003#,
Intel_16(Unsigned_16(r-1)) &
Intel_16(Unsigned_16(c-1)) &
Cell_attributes(xl) &
IEEE_Double_Intel(num)
);
when BIFF3 | BIFF4 =>
WriteBiff(xl, 16#0203#,
Intel_16(Unsigned_16(r-1)) &
Intel_16(Unsigned_16(c-1)) &
Intel_16(Unsigned_16(xl.xf_in_use)) &
IEEE_Double_Intel(num)
);
end case;
Jump_to(xl, r, c+1); -- Store and check new position
end Write_as_double;
-- Internal. This is BIFF2 only. BIFF format choice unchecked here.
--
procedure Write_as_16_bit_unsigned (