jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.51k stars 333 forks source link

Formats in a file other than the main one #333

Closed sapomuyverde closed 3 years ago

sapomuyverde commented 3 years ago

Hi,

I am using a libxlsxwriter (harbour) wrapper

I am trying to put the formats in another file independent of the main code, so I try something like this:

main code/file:

workbook  = workbook_new("venta.xlsx")
worksheet = workbook_add_worksheet(workbook, 'venta')

excelFormats(workbook)

worksheet_merge_range(worksheet,  3, 0, 3, 11, "Title", header)  

in another function/file

PROCEDURE excelFormats(workbook)
header = workbook_add_format(workbook)
textLeft = workbook_add_format(workbook)

format_set_bold(header)
format_set_align(header, LXW_ALIGN_CENTER)
format_set_align(header, LXW_ALIGN_VERTICAL_CENTER)
format_set_font_name(header, "Calibri")
format_set_font_size(header,11)

format_set_align(textLeft, LXW_ALIGN_LEFT)
format_set_align(textLeft, LXW_ALIGN_VERTICAL_CENTER)
format_set_font_name(textLeft, "Calibri")
format_set_font_size(textLeft, 09)

but this doesn't work for me, I mean, the formats in the generated Excel file do not take effect, can you please give me an idea how to solve what I require, it doesn't matter that the example is in the C language just to know how to make this implementation.

I appreciate your time.

Regards, Javier

jmcnamara commented 3 years ago

I don't know what the issue is. The code looks fine. If it was in C or Python it would work as expected. Maybe ask on Stackoverflow or ask the maintainer of the Harbour port.

sapomuyverde commented 3 years ago

Thanks for answering, surely it is something related to Harbour, I will contact the author of the wrapper as you suggest.