text
stringlengths
0
234
white => (1, 1),
red => (2, 2),
green => (3, 3),
blue => (4, 4),
yellow => (5, 5),
magenta => (6, 6),
cyan => (7, 7),
others => auto_color
),
BIFF3 | BIFF4 =>
(black => (8, 8),
white => (9, 9),
red => (10, 10),
green => (11, 11),
blue => (12, 12),
yellow => (13, 13),
magenta => (14, 14),
cyan => (15, 15),
dark_red => (16, 16),
dark_green => (17, 17),
dark_blue => (18, 18),
olive => (19, 19),
purple => (20, 20),
teal => (21, 21),
silver => (22, 22),
grey => (23, 23),
automatic => auto_color
)
);
-- *** Exported procedures **********************************************
-- 5.115 XF - Extended Format
procedure Define_format(
xl : in out Excel_Out_Stream;
font : in Font_type; -- Default_font(xl), or given by Define_font
number_format : in Number_format_type; -- built-in, or given by Define_number_format
cell_format : out Format_type;
-- Optional parameters --
horizontal_align : in Horizontal_alignment:= general_alignment;
border : in Cell_border:= no_border;
shaded : in Boolean:= False; -- Add a dotted background pattern
background_color : in Color_type:= automatic;
wrap_text : in Boolean:= False;
vertical_align : in Vertical_alignment:= bottom_alignment;
text_orient : in Text_orientation:= normal
)
is
actual_number_format: Number_format_type:= number_format;
cell_is_locked: constant:= 1;
-- ^ Means actually: cell formula protection is possible, and enabled when sheet is protected.
procedure Define_BIFF2_XF is
border_bits, mask: Unsigned_8;
begin
border_bits:= 0;
mask:= 8;
for s in Cell_border_single loop
if border(s) then
border_bits:= border_bits + mask;
end if;
mask:= mask * 2;
end loop;
-- 5.115.2 XF Record Contents, p. 221 for BIFF3
WriteBiff(
xl,
16#0043#, -- XF code in BIFF2
(Unsigned_8(font),
-- ^ Index to FONT record
0,
-- ^ Not used
Number_format_type'Pos(actual_number_format) + 16#40# * cell_is_locked,
-- ^ Number format and cell flags
Horizontal_alignment'Pos(horizontal_align) +
border_bits +
Boolean'Pos(shaded) * 128
-- ^ Horizontal alignment, border style, and background
)
);
end Define_BIFF2_XF;
area_code: Unsigned_16;
procedure Define_BIFF3_XF is
begin
-- 5.115.2 XF Record Contents, p. 221 for BIFF3
WriteBiff(
xl,
16#0243#, -- XF code in BIFF3
(Unsigned_8(font),
-- ^ 0 - Index to FONT record
Number_format_type'Pos(actual_number_format),
-- ^ 1 - Number format and cell flags
cell_is_locked,
-- ^ 2 - XF_TYPE_PROT (5.115.1)
16#FF#
-- ^ 3 - XF_USED_ATTRIB
) &
Intel_16(
Horizontal_alignment'Pos(horizontal_align) +
Boolean'Pos(wrap_text) * 8