Different color for table of contents entry and page numbers - python-2.7

I am generating a clickable (=with links) table of contents. In order to emphasize the 'clickability' of the entries I want them colored as links (i.e. blue color and underline).
I have this code for setting the style:
toc = TableOfContents()
toc.levelStyles[0].fontName = 'Arial Bold'
toc.levelStyles[0].fontSize = 12
toc.levelStyles[0].textColor = '#0000cc'
and use this code to add each entry:
toc.addEntry(0, '<u>' + entrytext + '</u>', pageNum, str(id(page)))
It works ok, the problem is that page numbers turn out blue as well. I tried to look around SO and the user guide for ways to put a different style for each - but was unsuccessful. Any ideas?
Thanks.

Related

Coloring a table in apache superset

I want to color the background bars (or the entire cells) of the table as shown in the appended screenshot based on the "Group-By"/dimension value (red for "rot", yellow for "gelb" and green for "grĂ¼n").
I was able to color the metric-part of other visualizations with label_colors, but I have not yet found a way to color the cells of the table based on a "dimension".
Is there a way to do this?
As of now:
EDIT: I wanted to color it the following way (edited with paint):
This is a tad hacky, but you can add a markdown component and add the following markup:
<style>
th {
color: red; /* or whatever color/hex code you want */
}
</style>
The markdown component will be blank after you add this--i.e. there will just be a blank markdown block-- so you may want to add some copy. Alternatively, if you already have a markdown block, you can add it there, and it won't appear as long as you remember the <style></style> tags.

How can I change the color of inside borders only for header columns?

I want to have output a table into RTF that has no lines inside the table but has the inside border in header cells. In addition, the header column is colorful. I know how to change the border color for all the cells but I can't figure out how to only change the header ones. I need to do it with proc template. Right now I get this table:
But I need to have it like this:
The code is :
proc template;
define style styles.new;
parent = Styles.Printer;
replace color_list /
'link' = blue
'bgH' = cxFF8200
'bgT' = white
'bgD' = white
'fg' = black
'bg' = white;
replace Table from Output /
frame = hsides
rules = groups
cellpadding = 2pt
cellspacing = 0.25pt
borderwidth = 0.75pt
background = color_list('bgt') ;
end;
run;
ods listing style=new;
Could someone tell me please how could I change the code to get the correct output?
Thank you!
The white column header separation 'lines' you are seeing are not actually drawn.
Change to cellspacing=1in and you will observe that the 'lines' are actually artifacts of the spacing and correspond to the overall background. I don't think there is an easy way to have header cell borders that are different than data cell borders.

Format a text on cell in two color in Coldfusion

Using Coldfusion 10, I need to format a cell contents in two color(Black and Blue). Let a cell on spreadsheet contains a string "Text1: Text2". where color of "Text1" should be black and "Text2" should be blue.
I have tried below code, but it produces all blue text.
SpreadsheetAddRow(spreadsheetData,"Text1: Text2",1,1);
format1=StructNew();
format1.color="black";
SpreadsheetFormatRow(spreadsheetData,format1,1);
format1.color="blue";
SpreadsheetFormatRow(spreadsheetData,format1,1);
How I can apply two color to format single cell ?
It is not supported with the built in functions. However, you can tap into the underlying POI library and use a RichTextString to accomplish this.
Assuming you have already created the worksheet and an empty cell:
spreadsheetData = SpreadSheetNew("Sheet1", true);
SpreadsheetAddRow(spreadsheetData,"",1,1);
Grab reference to the underlying Workbook and create fonts with the appropriate colors:
wb = spreadsheetData.getWorkbook();
Colors = createObject("java", "org.apache.poi.ss.usermodel.IndexedColors");
greenFont = wb.createFont();
greenFont.setColor(Colors.GREEN.index);
blueFont = wb.createFont();
blueFont.setColor(Colors.BLUE.index);
Then create a RichTextString object and append each part of the text with the desired color:
// Using GREEN and BLUE for demo purposes
richString = createObject("java", "org.apache.poi.xssf.usermodel.XSSFRichTextString").init();
richString.append("Text1: ", greenFont);
richString.append("Text2", blueFont);
Finally, apply the RichTextString to the empty cell, ie A1 you created earlier. Note, unlike in CF, the indexes are 0-based.
cell = wb.getSheet("Sheet1").getRow( 0 ).getCell( 0 );
cell.setCellValue(richString);

wxPython Toolbook/Toolbar, blank space between toolbar and frame

The screenshot is a snip of the left side of my main frame. This frame has a toolbook at the top. I've set the background color of both the toolbar in the toolbook and the frame to 0,0,0 but, as you can see, there is a small blank line between the two. How do I get that line gone or how do I make it black, as well?
As a quick side question -- is there a way to change the color of the "selected" halo on the toolbar to something a bit more contrasted for black? You can see the very faint blue halo around that first icon, I'd like that to be a much lighter blue, if possible.
EDIT: Code added --
il = wx.ImageList(128, 128)
for tab in self.package.vars["tabs"]:
il.Add(wx.Image(self.package.vars["iconPath"].format(tab), wx.BITMAP_TYPE_PNG).ConvertToBitmap())
self.AssignImageList(il)
imageIdGenerator = self.getNextImageID(il.GetImageCount())
pages = [(wx.Panel(parent = self.parent, id = wx.ID_ANY), name.capitalize()) for name in self.package.vars["tabs"]]
imID = 0
toolbar = self.GetToolBar()
toolbar.SetBackgroundColour(self.package.vars["bgColor"])
toolbar.AddStretchableSpace()
for page, label in pages:
self.AddPage(page, label, imageId=imageIdGenerator.next())
page.SetBackgroundColour(c.COLORS["green"])
imID += 1
toolbar.AddStretchableSpace()
pages = [(wx.Panel(parent = self.parent, id = wx.ID_ANY), name.capitalize()) for name in self.package.vars["tabs"]]
maybe this wx.Panel in the list comprehension still has the default color. what happens if you apply SetBackgroundColour to these panels as well?
(edit)
How about removing that boarder space by
self.SetInternalBorder(0)
self here is Toolbook class. It seems to work on wxPython Demo Toolbook example.

Position title Aspose slide chart

Is it possible to position the title of a Aspose powerpoint slide chart?
I have tried following:
chart.ChartTitle.X = 100;
chart.ChartTitle.Y = 100;
With different values but title is not moved.
Since it is not possible to move the chart title I simply created a title just above the chart using a regular autoshape, something like this:
IAutoShape autoshape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 20, 0, 600, 50);
autoshape.UseBackgroundFill = true;
autoshape.LineFormat.FillFormat.FillType = FillType.NoFill;
autoshape.AddTextFrame(" ");
ITextFrame txtFrame = autoshape.TextFrame;
IParagraph para = txtFrame.Paragraphs[0];
IPortion portion = para.Portions[0];
portion.Text = title;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
I have observed the code shared by you and it is Ok despite the values set for it. Inside the chart area the value is between 0-1. (0,0)(X,Y) being the bottom left and (1,1)(X,Y) being top right corner of chart. But still this feature is not working and there seems to be issue in API. You can contact Aspose.Slides support team over following link to log request for your issue.
http://www.aspose.com/community/forums/aspose.slides-product-family/109/showforum.aspx
Yes, you are right. This is an alternate approach that you may try on your end to super impose an auto shape containing the chart title as overlay on the chart. However, in this approach you need to identify the appropriate position of auto shape over the chart to serve as title.
Yes this is one of the alternates that you can use on your end.