Reputation: 101
I am using module xlsxwriter to generate the sample reports and I want to add a graphic text to sign it. Like this:
I have read the documentation on Xlsxwriter's Site but I cannot find any solutions for setting transparency (I mean that you can see the Qty underneath character l) and rotation for the text. Could anyone have any ideas on this case?
Upvotes: 2
Views: 587
Reputation: 41574
You can set transparency in a textbox in XlsxWriter by turning the solid fill and the border off. Here is an example: import xlsxwriter
workbook = xlsxwriter.Workbook('textbox.xlsx')
worksheet = workbook.add_worksheet()
# Set the column wider for clarity.
worksheet.set_column('A:A', 60)
# Add some sample text.
for row in range(10):
worksheet.write(row, 0, "Here is some text in the background")
# Set the textbox options.
options = {
'width': 500,
'height': 100,
'font': {'italic': True,
'color': '#DDDDDD',
'size': 60},
'fill': {'none': True},
'line': {'none': True},
}
# Insert the textbox over the cell text.
worksheet.insert_textbox('A3', 'Sample Report', options)
workbook.close()
Output:
See the Working with Textboxes section of the XlsxWriter documentation.
However, I don't think it is possible in Excel to rotate the text in a textbox (apart from vertical and rotate up/down). The option to rotate at an angle is greyed out in Excel.
I think the image in your post is probably achieved using WordArt, which isn't supported by XlsxWriter.
Upvotes: 2