New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: insert_shape #107

Closed
rm234179 opened this Issue Feb 18, 2014 · 10 comments

Comments

5 participants
@rm234179

I would like to make a feature request for an insert shape functionality similar to the insert_image.

Specifically, I need to insert a colored rectangle with some text in it. (See the screen shot below for a few basic examples of what I would like).

image

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Feb 18, 2014

Owner

Noted. However, this is a fairly non-trivial task. You may be waiting quite a while. :-(

John

Owner

jmcnamara commented Feb 18, 2014

Noted. However, this is a fairly non-trivial task. You may be waiting quite a while. :-(

John

@rm234179

This comment has been minimized.

Show comment
Hide comment
@rm234179

rm234179 Feb 18, 2014

I understand, and I would be happy to help.

I noticed in workbook.py that there is a commented out reference to

sheet._prepare_shape(index, drawing_id)

. And in worksheet.py there is an array of shapes (e.g. self.shapes = []). Do both of these refer to the shapes that I am requesting or are these something else?

I understand, and I would be happy to help.

I noticed in workbook.py that there is a commented out reference to

sheet._prepare_shape(index, drawing_id)

. And in worksheet.py there is an array of shapes (e.g. self.shapes = []). Do both of these refer to the shapes that I am requesting or are these something else?

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Feb 19, 2014

Owner

Do both of these refer to the shapes that I am requesting or are these something else?

Some of the infrastructure is there since this feature is supported, experimentally, in the Perl version of the module.

However, I'm not content to do a straight port of that feature in its present state. It would need significantly more tests and some refactoring.

If this feature request get more +1s I consider doing that.

Regards,

John

Owner

jmcnamara commented Feb 19, 2014

Do both of these refer to the shapes that I am requesting or are these something else?

Some of the infrastructure is there since this feature is supported, experimentally, in the Perl version of the module.

However, I'm not content to do a straight port of that feature in its present state. It would need significantly more tests and some refactoring.

If this feature request get more +1s I consider doing that.

Regards,

John

@jmcnamara jmcnamara self-assigned this Feb 19, 2014

@JazzFan

This comment has been minimized.

Show comment
Hide comment

JazzFan commented Aug 28, 2014

👍

@georgelovas

This comment has been minimized.

Show comment
Hide comment

+1

@tooh

This comment has been minimized.

Show comment
Hide comment

tooh commented Mar 22, 2015

+1

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Mar 25, 2015

Owner

@JazzFan and @tooh

In this feature, what types of shapes are you interested in?

Owner

jmcnamara commented Mar 25, 2015

@JazzFan and @tooh

In this feature, what types of shapes are you interested in?

@tooh

This comment has been minimized.

Show comment
Hide comment
@tooh

tooh Mar 25, 2015

As a Projectmanager I want to have an Excel created where depending on a start and end date a number off cells are coloured in order to display a time-line. (weeks/months)

More ore less as @rm234179 described

tooh commented Mar 25, 2015

As a Projectmanager I want to have an Excel created where depending on a start and end date a number off cells are coloured in order to display a time-line. (weeks/months)

More ore less as @rm234179 described

jmcnamara added a commit that referenced this issue Mar 27, 2015

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Mar 27, 2015

Owner

Hi,

I've pushed an implementation of textbox support to the master branch of XlsxWriter.

The interface and formatting are similar to charts:

import xlsxwriter

workbook = xlsxwriter.Workbook('textbox.xlsx')
worksheet = workbook.add_worksheet()

worksheet.insert_textbox('B3', 'This is some text in a textbox', 
                         {'x_offset': 10, 
                          'y_offset': 10,
                          'width': 200,
                          'height': 100,
                          'align': {'vertical': 'middle',
                                    'horizontal': 'center'
                                    },
                          'gradient': {'colors': ['#DDEBCF',
                                                  '#9CB86E',
                                                  '#156B13']
                                       },
                          })

workbook.close()

Which produces a textbox like this:

apicture

I'll be working on examples and documentation in the next few days but if you would like to try it out then let me know of any issues you encounter.

John

Owner

jmcnamara commented Mar 27, 2015

Hi,

I've pushed an implementation of textbox support to the master branch of XlsxWriter.

The interface and formatting are similar to charts:

import xlsxwriter

workbook = xlsxwriter.Workbook('textbox.xlsx')
worksheet = workbook.add_worksheet()

worksheet.insert_textbox('B3', 'This is some text in a textbox', 
                         {'x_offset': 10, 
                          'y_offset': 10,
                          'width': 200,
                          'height': 100,
                          'align': {'vertical': 'middle',
                                    'horizontal': 'center'
                                    },
                          'gradient': {'colors': ['#DDEBCF',
                                                  '#9CB86E',
                                                  '#156B13']
                                       },
                          })

workbook.close()

Which produces a textbox like this:

apicture

I'll be working on examples and documentation in the next few days but if you would like to try it out then let me know of any issues you encounter.

John

jmcnamara added a commit that referenced this issue Mar 29, 2015

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Mar 29, 2015

Owner

Hi,

I've added support for textboxes to version 0.7.2 of XlsxWriter now on PyPi.

See the Working with Textboxes section of the docs for details.

This doesn't add full support for shapes in general but based on feedback it seems that the main shape people were interested in was the textbox.

So, I'm going to close this feature request issue. If there are any issues or further feature requests related to this then open another issue.

Regards,

John

Owner

jmcnamara commented Mar 29, 2015

Hi,

I've added support for textboxes to version 0.7.2 of XlsxWriter now on PyPi.

See the Working with Textboxes section of the docs for details.

This doesn't add full support for shapes in general but based on feedback it seems that the main shape people were interested in was the textbox.

So, I'm going to close this feature request issue. If there are any issues or further feature requests related to this then open another issue.

Regards,

John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment