org-mode export headlines levels only, not inline text - org-mode

I am trying to export headline levels only to an ODT file, without the inline text under each heading.
[Org file structure]
* Heading 1
+ Blah Blah
** Heading 1.1
+ Blah Blah
- Blah Blah
* Heading 2
[Exported structure]
* Heading 1
** Heading 1.1
* Heading 2

You could easily cycle only through the headlines (S-tab) and then export with the option visible only. (C-v).

Related

sas horizontal bar chart-Making labels same size

I'm using a macro to generate many similar horizontal bar charts. The chart width changes according to the labels (on the vertical axis) length.
How I can make all the charts the same width causing the labels to wrap automatically to adjust?
data my_annoDetailedChart&i; set FinalDim&i;
xsys='2'; ysys='2'; hsys='3'; when='a';
group=itemname;
midpoint=entity;
x=score;
function='label'; position='>'; color='grayaa'; size=1.5;
text=" "||trim(left(put(score,comma5.2)));
goptions device=png;
goptions xpixels=700 ypixels=450;
goptions noborder;
goptions cback=white;
goptions gunit=pct ftitle="albany amt/bold" ftext="albany amt" hsize=6.5 vsize= 7.6 inches
htitle=4.1 htext=1.5 ctext=gray44;************************************************************************************************************;
*---Indicators---------------------------------------------------------------------------------------------;
pattern1 v=solid c=navy; /* blue */
pattern2 v=solid c=lightgray; /* green */
pattern1 v=solid c=navy; /* blue */
pattern2 v=solid c=lightgray; /* green */
axis1 SPLIT="*" label=none order=(1 to 5 by .5) minor=none offset=(0,0)
color=graydd major=(color=gray44) value=(color=gray44);
axis2 SPLIT="*" label=none value=none ;
axis3 label=none offset=(3,3);* order=( &KOko);
legend1 position=(bottom right inside) mode=share label=none shape=bar(.15in,.15in) offset=(-1,-0.1);
proc gchart data=FinalDim&i anno=my_annoDetailedChart&i;
hbar entity / discrete type=sum sumvar=Score nostat
subgroup=entity group=itemname space=0 gspace=1
raxis=axis1 maxis=axis2 gaxis=axis3 autoref
legend=legend1 clipref ;
title color=navy h=6 font="Times New Roman" "&Dimension";

String Concatenating functions in Progress 4GL?

I came across a function in C#, string.Join() which is really helpful for string concatenation.
I am wondering is there any possibility of doing the same functionality in Progress 4GL ?
Typical C# example would be,
String result = “ ”;
result = string.Join(",", this.grpBox1.Controls.OfType<CheckBox>()
.Where(x => x.Checked)
.Select(c => c.Text));
MessageBox.Show(result);
I am not trying to convert C# to Progress but it would be really helpful if i could achieve the same functionality in Progress.
if you do really want your function you could wrap it and declare it as external you can re-link _progres to include your own c libs. used to be called HLC (probuild) but now its a set of scripts under a new directory name oebuild directly under the Progress install directory(DLC). The hlc and make directories are under the oebuild directory.
Instructions on the build process can be found in the README file located in the oebuild directory under the DLC directory. Prob. a sledge hammer to crack a nut you would have to understand what your doing not for the faint of heart. but if you have something written in c you want to call you can do it. prob. best to stick to the 4gl nearest thing progress has to arrays is extent not used much most people break out to a temp table . rows in a tt are far easier to handle and iterate so its a "mind set" switch a bit.
Important comments can also be found in the hlprodsp.c file located in the hlc directory, a subdirectory of oebuild.
As far as I know, there's nothing built in to that effort. But if I understand correctly, when you issue that command you get a list of that given object type (in your example, checkbox) as a CSV.
I built something that resembles it, as a start to whatever you'd like to implement. It's probably far from perfect, but it works for me. It's a window with various widget types, you select from the combo the type you'd like to search and generate, and it will show you at the end the values of two CSV variables: one with the widget names that match that type, and one with the respective values.
Here it goes:
&Scoped-define WINDOW-NAME C-Win
/*------------------------------------------------------------------------
File:
Description:
Input Parameters:
<none>
Output Parameters:
<none>
Author:
Created:
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AppBuilder. */
/*----------------------------------------------------------------------*/
/* Create an unnamed pool to store all the widgets created
by this procedure. This is a good default which assures
that this procedure's triggers and internal procedures
will execute in this procedure's storage, and that proper
cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
/* *************************** Definitions ************************** */
/* Parameters Definitions --- */
/* Local Variable Definitions --- */
DEFINE VARIABLE cWidgetLst AS CHARACTER NO-UNDO.
DEFINE VARIABLE cValueLst AS CHARACTER NO-UNDO.
/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE Window
&Scoped-define DB-AWARE no
/* Name of designated FRAME-NAME and/or first browse and/or first query */
&Scoped-define FRAME-NAME DEFAULT-FRAME
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS COMBO-BOX-1 BUTTON-1 SLIDER-1 SELECT-1 ~
RADIO-SET-1 TOGGLE-1 FILL-IN-2 COMBO-BOX-3
&Scoped-Define DISPLAYED-OBJECTS COMBO-BOX-1 SLIDER-1 SELECT-1 RADIO-SET-1 ~
TOGGLE-1 FILL-IN-2 COMBO-BOX-3
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* *********************** Control Definitions ********************** */
/* Define the widget handle for the window */
DEFINE VAR C-Win AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
DEFINE BUTTON BUTTON-1
LABEL "Generate"
SIZE 15 BY 1.14.
DEFINE VARIABLE COMBO-BOX-1 AS CHARACTER FORMAT "X(256)":U
VIEW-AS COMBO-BOX INNER-LINES 5
LIST-ITEMS "Fill-in","Radio-set","Toggle-box","Selection-List","slider","combo-box"
DROP-DOWN-LIST
SIZE 16 BY 1 NO-UNDO.
DEFINE VARIABLE COMBO-BOX-3 AS CHARACTER FORMAT "X(256)":U
LABEL "Combo 3"
VIEW-AS COMBO-BOX INNER-LINES 5
LIST-ITEMS "Large","Tall","Venti"
DROP-DOWN-LIST
SIZE 16 BY 1 NO-UNDO.
DEFINE VARIABLE FILL-IN-2 AS CHARACTER FORMAT "X(256)":U
LABEL "Fill 2"
VIEW-AS FILL-IN
SIZE 14 BY 1 NO-UNDO.
DEFINE VARIABLE RADIO-SET-1 AS INTEGER
VIEW-AS RADIO-SET VERTICAL
RADIO-BUTTONS
"Item 1", 1,
"Item 2", 2,
"Item 3", 3
SIZE 12 BY 3 NO-UNDO.
DEFINE VARIABLE SELECT-1 AS CHARACTER
VIEW-AS SELECTION-LIST SINGLE SCROLLBAR-VERTICAL
LIST-ITEMS "First","Second","Third"
SIZE 23 BY 2 NO-UNDO.
DEFINE VARIABLE SLIDER-1 AS INTEGER INITIAL 0
VIEW-AS SLIDER MIN-VALUE 0 MAX-VALUE 100 HORIZONTAL
TIC-MARKS NONE
SIZE 31 BY 2.38 NO-UNDO.
DEFINE VARIABLE TOGGLE-1 AS LOGICAL INITIAL no
LABEL "Toggle 1"
VIEW-AS TOGGLE-BOX
SIZE 13.4 BY .81 NO-UNDO.
DEFINE VARIABLE COMBO-BOX-2 AS CHARACTER FORMAT "X(256)":U
LABEL "Combo 2"
VIEW-AS COMBO-BOX INNER-LINES 5
LIST-ITEMS "Item 1"
DROP-DOWN-LIST
SIZE 16 BY 1 NO-UNDO.
DEFINE VARIABLE FILL-IN-3 AS CHARACTER FORMAT "X(256)":U
LABEL "Fill 3"
VIEW-AS FILL-IN
SIZE 14 BY 1 NO-UNDO.
DEFINE VARIABLE RADIO-SET-2 AS INTEGER
VIEW-AS RADIO-SET VERTICAL
RADIO-BUTTONS
"Item 1", 1,
"Item 2", 2,
"Item 3", 3
SIZE 12 BY 3 NO-UNDO.
DEFINE VARIABLE SLIDER-2 AS INTEGER INITIAL 0
VIEW-AS SLIDER MIN-VALUE 0 MAX-VALUE 100 HORIZONTAL
TIC-MARKS NONE
SIZE 17 BY 2.14 NO-UNDO.
DEFINE VARIABLE TOGGLE-2 AS LOGICAL INITIAL no
LABEL "Toggle 2"
VIEW-AS TOGGLE-BOX
SIZE 13.4 BY .81 NO-UNDO.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME DEFAULT-FRAME
COMBO-BOX-1 AT ROW 1.95 COL 13 COLON-ALIGNED NO-LABEL WIDGET-ID 14
BUTTON-1 AT ROW 1.95 COL 32 WIDGET-ID 2
SLIDER-1 AT ROW 3.62 COL 42 NO-LABEL WIDGET-ID 18
SELECT-1 AT ROW 3.86 COL 10 NO-LABEL WIDGET-ID 16
RADIO-SET-1 AT ROW 6.24 COL 10 NO-LABEL WIDGET-ID 6
TOGGLE-1 AT ROW 6.24 COL 30 WIDGET-ID 10
FILL-IN-2 AT ROW 7.19 COL 28 COLON-ALIGNED WIDGET-ID 12
COMBO-BOX-3 AT ROW 7.29 COL 56 COLON-ALIGNED WIDGET-ID 20
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 80 BY 16 WIDGET-ID 100.
DEFINE FRAME FRAME-A
TOGGLE-2 AT ROW 1.24 COL 51 WIDGET-ID 6
RADIO-SET-2 AT ROW 1.48 COL 3 NO-LABEL WIDGET-ID 2
FILL-IN-3 AT ROW 1.95 COL 25 COLON-ALIGNED WIDGET-ID 8
SLIDER-2 AT ROW 3.14 COL 46 NO-LABEL WIDGET-ID 12
COMBO-BOX-2 AT ROW 3.38 COL 24 COLON-ALIGNED WIDGET-ID 10
WITH 1 DOWN KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 5 ROW 10.29
SIZE 72 BY 5.71
TITLE "Frame A" WIDGET-ID 200.
/* *********************** Procedure Settings ************************ */
/* Settings for THIS-PROCEDURE
Type: Window
Allow: Basic,Browse,DB-Fields,Window,Query
Other Settings: COMPILE
*/
/* ************************* Create Window ************************** */
IF SESSION:DISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW C-Win ASSIGN
HIDDEN = YES
TITLE = "<insert window title>"
HEIGHT = 16
WIDTH = 80
MAX-HEIGHT = 16
MAX-WIDTH = 80
VIRTUAL-HEIGHT = 16
VIRTUAL-WIDTH = 80
RESIZE = yes
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
KEEP-FRAME-Z-ORDER = yes
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
/* END WINDOW DEFINITION */
/* *********** Runtime Attributes and AppBuilder Settings *********** */
/* SETTINGS FOR WINDOW C-Win
VISIBLE,,RUN-PERSISTENT */
/* REPARENT FRAME */
ASSIGN FRAME FRAME-A:FRAME = FRAME DEFAULT-FRAME:HANDLE.
/* SETTINGS FOR FRAME DEFAULT-FRAME
FRAME-NAME */
DEFINE VARIABLE XXTABVALXX AS LOGICAL NO-UNDO.
ASSIGN XXTABVALXX = FRAME FRAME-A:MOVE-AFTER-TAB-ITEM (COMBO-BOX-3:HANDLE IN FRAME DEFAULT-FRAME)
/* END-ASSIGN-TABS */.
/* SETTINGS FOR FRAME FRAME-A
*/
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
THEN C-Win:HIDDEN = no.
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME C-Win
ON END-ERROR OF C-Win /* <insert window title> */
OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the
application would exit. */
IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
END.
ON WINDOW-CLOSE OF C-Win /* <insert window title> */
DO:
/* This event will close the window and terminate the procedure. */
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN NO-APPLY.
END.
&Scoped-define SELF-NAME BUTTON-1
ON CHOOSE OF BUTTON-1 IN FRAME DEFAULT-FRAME /* Generate */
DO:
assign cWidgetLst = ''
cValueLst = ''.
run downTheRabbitHole ( input {&window-name}:handle).
MESSAGE cWidgetLst SKIP cValueLst
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
&UNDEFINE SELF-NAME
/* *************************** Main Block *************************** */
/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames. */
ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}
THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
/* The CLOSE event can be used from inside or outside the procedure to */
/* terminate it. */
ON CLOSE OF THIS-PROCEDURE
RUN disable_UI.
/* Best default for GUI applications is... */
PAUSE 0 BEFORE-HIDE.
/* Now enable the interface and wait for the exit condition. */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire. */
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
RUN enable_UI.
IF NOT THIS-PROCEDURE:PERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.
/* ********************** Internal Procedures *********************** */
PROCEDURE buildCSV :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT-OUTPUT PARAMETER iopcList AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER ipcValue AS CHARACTER NO-UNDO.
if ipcValue = ? then
assign ipcValue = '?'.
if ipcValue = '' then
assign ipcValue = ' '.
assign iopcList = iopcList + (if iopcList = '' then '' else ',') + ipcValue.
END PROCEDURE.
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
Purpose: DISABLE the User Interface
Parameters: <none>
Notes: Here we clean-up the user-interface by deleting
dynamic widgets we have created and/or hide
frames. This procedure is usually called when
we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
/* Delete the WINDOW we created */
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
THEN DELETE WIDGET C-Win.
IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
END PROCEDURE.
PROCEDURE downTheRabbitHole :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER iphWidget AS HANDLE NO-UNDO.
DEFINE VARIABLE hHandle AS HANDLE NO-UNDO.
assign hHandle = iphWidget:first-child.
do while valid-handle(hHandle):
if can-query(hHandle,"type") and hHandle:type = combo-box-1:screen-value in frame {&frame-name} then do:
/* something something something dark side... */
if can-query(hHandle,"name") then run buildCSV(input-output cWidgetLst,hHandle:name).
if can-query(hHandle,"screen-value") then run buildCSV(input-output cValueLst,hHandle:screen-value).
end.
if hHandle:type = "FIELD-GROUP" or hHandle:type = "FRAME" then
run downTheRabbitHole(input hHandle:first-child).
assign hHandle = hHandle:next-sibling.
end.
END PROCEDURE.
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
Purpose: ENABLE the User Interface
Parameters: <none>
Notes: Here we display/view/enable the widgets in the
user-interface. In addition, OPEN all queries
associated with each FRAME and BROWSE.
These statements here are based on the "Other
Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
DISPLAY COMBO-BOX-1 SLIDER-1 SELECT-1 RADIO-SET-1 TOGGLE-1 FILL-IN-2
COMBO-BOX-3
WITH FRAME DEFAULT-FRAME IN WINDOW C-Win.
ENABLE COMBO-BOX-1 BUTTON-1 SLIDER-1 SELECT-1 RADIO-SET-1 TOGGLE-1 FILL-IN-2
COMBO-BOX-3
WITH FRAME DEFAULT-FRAME IN WINDOW C-Win.
{&OPEN-BROWSERS-IN-QUERY-DEFAULT-FRAME}
DISPLAY TOGGLE-2 RADIO-SET-2 FILL-IN-3 SLIDER-2 COMBO-BOX-2
WITH FRAME FRAME-A IN WINDOW C-Win.
ENABLE TOGGLE-2 RADIO-SET-2 FILL-IN-3 SLIDER-2 COMBO-BOX-2
WITH FRAME FRAME-A IN WINDOW C-Win.
{&OPEN-BROWSERS-IN-QUERY-FRAME-A}
VIEW C-Win.
END PROCEDURE.

Hello, how do I copy text and paste it into another line in notepad?

how do I copy text and paste it into another line in notepad?
need to copy the text between "0;" and ";"
then paste it in the desired location.
How do I do that?
tried using regular expressions, but could not.
example:
filename new.txt
Start
1- 0; Text 1 ;
2- line 1
3- line 1
4- line 3
5-
6- 0; Text 2 ;
7- line 1
8- line 1
9- line 3
10-
11- 0; Text 3 ;
12- line 1
13- line 1
14- line 3
end
change to:
filename new.txt
Start
1- 0; Text 1 ;
2- line 1
3- line 1
4- line 3 Text 1
5-
6- 0; Text 2 ;
7- line 1
8- line 1
9- line 3Text 2
10-
11- 0; Text 3 ;
12- line 1
13- line 1
14- line 3 Text 3
end
Not a question for Stack Overflow.
Select the text by clicking and dragging, making the desired portion blue.
Right-click the selection.
Click "Copy."
Move the cursor to the desired position, and right-click again.
Click "Paste."
Alternatively, you can press Ctrl and C to copy, and Ctrl and V to past.

sublime text 2 plugin to enter auto-license comment line with specific format

I am trying to set up a snippet in Sublime Text 2 that will expand to the following:
/**
* #version $Id: ${1:current_file_name.extension} ${2:random_4_digit_number} ${3:YYYY-MM-DD} ${4:time_in_UTC_24} ${5:current_logged-in_user} $
* #author Company http://example.com
* #copyright Copyright (C) 2007 - ${6:current_year} Company
* #license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
The above snippet has cursor stops. If all the data can be automated, then I wouldn't need any cursor stops.
The stops map as follows:
${1:current_file_name.extension}
Automatically pastes the name of the current file being edited.
${2:random_4_digit_number}
A randomly-generated number from 0000 to 9999
${3:YYYY-MM-DD}
The current date using - separator.
${4:time_in_UTC_24}
The current time in UTC 24-hour format including seconds using : separator.
${5:current_logged-in_user}
The currently logged in user
${6:current_year}
The current year
Any advice or help would be greatly appreciated.
It is probably not possible with a snippet, however I wrote a plugin to accomplish what you want. In Sublime, click Tools > New Plugin. Replace the example code with the following. Name it "add_license_stamp.py" and save it in your Packages folder (not in Packages/User). Also, add a keybinding in your keymap file. To run the command, place your cursor where you want it and press the keybinding:
Keybinding:
{ "keys": ["ctrl+shift+9"], "command": "add_license_stamp" }
Plugin:
import sublime, sublime_plugin
import os
import datetime
import random
import getpass
''' Add license stamp
/**
* #version $Id: ${1:current_file_name.extension} ${2:random_4_digit_number} ${3:YYYY-MM-DD} ${4:time_in_UTC_24} ${5:current_logged-in_user} $
* #author Company http://example.com
* #copyright Copyright (C) 2007 - ${6:current_year} Company
* #license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
'''
class AddLicenseStampCommand(sublime_plugin.TextCommand):
def run(self, edit):
company_name = "BobCo"
company_site = "http://bobco.com"
file_path = self.view.file_name()
file_name = os.path.basename(file_path)
year = datetime.datetime.utcnow().strftime("%Y")
date_time = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
random_number = str(random.randrange(0000, 9999)).zfill(4)
user = getpass.getuser()
license = "/**\n"
license += "* #version $Id: " + file_name + " " + random_number + " " + date_time + " " + user + " $\n"
license += "* #author " + company_name + " " + company_site + "\n"
license += "* #copyright Copyright (C) 2007 - " + year + " " + company_name + "\n"
license += "* #license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only\n"
license += "*/\n"
self.view.replace(edit, self.view.sel()[0], license)
(note: python requires a blank line after your code)
Replace "BobCo" with your company name. I'm not sure of the best way to get the current user name, I used this question: Is there a portable way to get the current username in Python? . They say it is compatible with the major OSes. If not do something similar to how I did the company name. And manually set it per user. Also, I don't know what UTC 24-hour format is. But I just used the time in 24 hour format.
Edit
I changed now() to utcnow() to get the utc date/time. I added date/time formatting. I added zfill(4) to the random number to pad it with zeros if under 4 digits. You can highlight the current stamp and hit the key binding to update it. You could also get fancy and automatically replace on save, but beyond the current scope. You would have to use a regex to find the current stamp. Then activate the script upon save instead of run.

Can you have cell specific background colors in the table-plus macro on Confluence?

I am using this table-plus macro with Confluence:
http://confluence.atlassian.com/display/CONFEXT/Table-plus+macro
Can I have cell level formatting? I only see column level formatting.
How to do this all depends on what plugins you have obtained and enabled. The built-in table cell syntax, while concise, has nowhere to put such customization. You may want to look at Adaptavist's plugin for Content Formatting Macros, especially the table macro -- you can throw bgcolor attributes on the cells with no problem.
Of course, after a point, it starts to look a lot like html, in which case you may just want to enable the HTML plugin that ships with Confluence, but you should first be aware of the security implications of doing so; it may not be appropriate for your environment.
You can apply a style to the table, table row or table cell using {html} or user defined macro.
Here are three macros for setting the background colour for a table cell, table row or the whole table.
Table Cell Background Colour macro
## Macro Title: tblcellbg
## Macro Description: Set background colour for a single table cell
## Macro has a body: N
## Categories: Formatting
## Body Processing: No body
## Output Format: HTML
## Output: JavaScript. Sets table cell background color via CSS
## Developed By: Underverse (http://stackoverflow.com/users/2093966/underverse)
## License: BY-NC-SA
## #param bgcolour:title=Background Color|type=string|required=true|desc=HTML colour or a HTML numeric #value
##
## Check for a blank first parameter
##
#if ($parambgcolour && $parambgcolour.length() > 0) ## If a parm name was used
#set ($bgcolor = $parambgcolour) ## then set the value locally
#elseif ($param0 && $param0.length() > 0) ## if no parm name
#set ($bgcolor = $param0) ## then use the first value
#else
#set ($bgcolor = "#DDFADE") ## no value so set a default
#end
#if ($bgcolor.contains('#')) ## For HTML colours #etc
#set ($bgcolorclass = $bgcolor.replaceAll('#', 'A')) ## Substritute any other char
#else
#set ($bgcolorclass = $bgcolor) ## or use the colourname itself
#end
<script type="text/javascript" class="$bgcolorclass$bgcolorclass">
AJS.$(document).ready(function() {
AJS.$(".$bgcolorclass$bgcolorclass").closest("td").css({"background-color": "$bgcolor"});
});
</script>
You can then use this macro in a wiki markup table, wiki macro table or into the wiki editor to set the background colour of the table cell.
|| Heading 1|| Heading 2 || Heading 3 |
| {tblcellbg:lightgreen} Apple | {tblcellbg:#FFFF33} Banana | Pear |
Table Row Background Colour macro
## Macro Title: tblrowbg
## Macro Description: Set background colour for a table row
## Macro has a body: N
## Categories: Formatting
## Body Processing: No body
## Output Format: HTML
## Output: JavaScript. Sets table row background color via CSS
## Developed By: Underverse (http://stackoverflow.com/users/2093966/underverse)
## License: BY-NC-SA
## #param bgcolour:title=Background Color|type=string|required=true|desc=HTML colour or a HTML numeric #value
##
##
## Check for a blank first parameter
##
#if ($parambgcolour && $parambgcolour.length() > 0) ## If a parm name was used
#set ($bgcolor = $parambgcolour) ## then set the value locally
#elseif ($param0 && $param0.length() > 0) ## if no parm name
#set ($bgcolor = $param0) ## then use the first value
#else
#set ($bgcolor = "#DDFADE") ## no value so set a default
#end
#if ($bgcolor.contains('#')) ## For HTML colours #etc
#set ($bgcolorclass = $bgcolor.replaceAll('#', 'A')) ## Substritute any other char
#else
#set ($bgcolorclass = $bgcolor) ## or use the colourname itself
#end
<script type="text/javascript" class="$bgcolorclass$bgcolorclass">
AJS.$(document).ready(function() {
AJS.$(".$bgcolorclass$bgcolorclass").closest("tr").css({"background-color": "$bgcolor"});
});
</script>
Put the macro in one of the cells in the row to be set.
|| Heading 1|| Heading 2 || Heading 3 |
| {tblrowbg:lightblue} Apple | Banana | Pear |
Use this macro with {tblcellbg} for finer control of cell colours.
|| Heading 1|| Heading 2 || Heading 3 |
| {tblrowbg:lightblue} Apple | {tblcellbg:#FFFF33} Banana | Pear |
Table Background Colour macro
## Macro Title: tblbg
## Macro Description: Set background colour for a table
## Macro has a body: N
## Categories: Formatting
## Body Processing: No body
## Output Format: HTML
## Output: JavaScript. Sets table background color via CSS
## Developed By: Underverse (http://stackoverflow.com/users/2093966/underverse)
## License: BY-NC-SA
## #param bgcolour:title=Background Color|type=string|required=true|desc=HTML colour or a HTML numeric #value
##
##
## Check for a blank first parameter
##
#if ($parambgcolour && $parambgcolour.length() > 0) ## If a parm name was used
#set ($bgcolor = $parambgcolour) ## then set the value locally
#elseif ($param0 && $param0.length() > 0) ## if no parm name
#set ($bgcolor = $param0) ## then use the first value
#else
#set ($bgcolor = "#DDFADE") ## no value so set a default
#end
#if ($bgcolor.contains('#')) ## For HTML colours #etc
#set ($bgcolorclass = $bgcolor.replaceAll('#', 'A')) ## Substritute any other char
#else
#set ($bgcolorclass = $bgcolor) ## or use the colourname itself
#end
<script type="text/javascript" class="$bgcolorclass$bgcolorclass">
AJS.$(document).ready(function() {
AJS.$(".$bgcolorclass$bgcolorclass").closest("table").css({"background-color": "$bgcolor"});
});
</script>
Put the macro in one of the cells in the table.
|| {tblbg:lightblue} Heading 1|| Heading 2 || Heading 3 |
| Apple | Banana | Pear |
Can be used with {tblrowbg} and {tblcellbg}.
JavaScript
Alternatively, wrap the javascript which sets the cell/row/table background colour {html} and put it into the table as code.
JS Table Cell BG Colour
|| Heading 1|| Heading 2 || Heading 3 |
| Apple |{html}<SCRIPT class=AFFFF33AFFFF33 type=text/javascript>
AJS.$(document).ready(function() {
AJS.$(".AFFFF33AFFFF33").closest("td").css({"background-color": "#FFFF33"});
}); </SCRIPT> {html} Banana | Pear |
JS Table Row BG Color
|| Heading 1|| Heading 2 || Heading 3 |
| {html}<SCRIPT class=lightbluelightblue type=text/javascript>
AJS.$(document).ready(function() {
AJS.$(".lightbluelightblue").closest("tr").css({"background-color": "lightblue"});
});
</SCRIPT>{html} Apple | Banana | Pear |
JS Table BG Color
|| {html}<SCRIPT class=pinkpink type=text/javascript>
AJS.$(document).ready(function() {
AJS.$(".pinkpink").closest("table").css({"background-color": "pink"});
});
</SCRIPT>{html} Heading 1|| Heading 2 || Heading 3 |
| Apple | Banana | Pear |
It is not possible to do this with the {table-plus} macro. However, you can do it in Confluence with a more advanced table formatting plugin as described by Zac.