DefineStyles
Back to ListDescription: Define the styles used in the cash-flow demo spreadsheet.
FileMaker Prototype:
Set Variable [$res; ACF_Run("DefineStyles"; int_wb)]
Category: EXCEL
Function source:
// Define the styles used in the spreadsheet.
function DefineStyles(int wb)
// Define header styles
Excel_addstyle(wb, "H1", json("Font", "Arial", "FontSize", 14, "Decoration", "Bold")); // Main header
Excel_addstyle(wb, "H2", "H1"); // Clone H1
Excel_SetStyleOptions(wb, "H2", json("FontSize", 12, "Decoration", "Bold")); // Smaller header
// Date headings
Excel_addstyle(wb, "CH", json(
"Font", "Arial",
"FontSize", 12,
"Decoration", "Bold",
"FillColor", "DDDDDD",
"Borders", json("Bottom", linetype_thin),
"NumFormatCode", 16
)); // Standard date heading style
// Summary sheet month name heading
Excel_addstyle(wb, "SCH", "CH"); // Clone CH
Excel_SetStyleOptions(wb, "SCH", json("NumFormatCode", 75)); // Month name and year (no day)
// Date headings for weekends
Excel_addstyle(wb, "CHSAT", "CH"); // Clone CH for Saturday
Excel_SetStyleOptions(wb, "CHSAT", json("FillColor", "FF757F")); // Highlight Saturdays in red
Excel_addstyle(wb, "CHSUN", "CH"); // Clone CH for Sunday
Excel_SetStyleOptions(wb, "CHSUN", json("FillColor", "EF9165")); // Highlight Sundays in orange
// Number formatting
Excel_AddStyle(wb, "num", json(
"Font", "Arial",
"FontSize", 11,
"NumFormatCode", 40
)); // General number style
// Sum line styles with borders
Excel_AddStyle(wb, "SumLine", "num"); // Clone num for sum lines
Excel_SetStyleOptions(wb, "SumLine", json(
"Decoration", "Bold",
"Borders", json("Bottom", linetype_double, "Top", linetype_thin)
)); // Sum line with bold font and double border below
// Sum line for expenses
Excel_AddStyle(wb, "SumExp", "SumLine"); // Clone SumLine
Excel_SetStyleOptions(wb, "SumExp", json("FillColor", "FFBFC0")); // Highlight in light red
// Sum line for income
Excel_AddStyle(wb, "SumInc", "SumLine"); // Clone SumLine
Excel_SetStyleOptions(wb, "SumInc", json("FillColor", "BEBFFF")); // Highlight in light blue
// Sum line for balance
Excel_AddStyle(wb, "SumBal", "SumLine"); // Clone SumLine
Excel_SetStyleOptions(wb, "SumBal", json("FillColor", "BFFFC0")); // Highlight in light green
return "OK";
end