draw a simple dashed line

388 views
Skip to first unread message

pdo...@adops.com

unread,
Jul 21, 2014, 4:19:06 PM7/21/14
to openpyx...@googlegroups.com
I am trying to a simple dashed line to a spreadsheet. Can I get an example how to do this?
Thanks

Charlie Clark

unread,
Jul 21, 2014, 4:27:19 PM7/21/14
to openpyx...@googlegroups.com
Hiya,

an example would be good but presumably you mean some kind of border.
Please look at the documentation on using styles.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Pete Douma

unread,
Jul 21, 2014, 4:36:12 PM7/21/14
to openpyx...@googlegroups.com
I tried to copy a spreadsheet that has two shapes. One is a dashed line and
the other is a rounded rectangle. Its definitely a shape because it does not
copy, so I figure I have to use openpyxl to draw new ones.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "openpyxl-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/openpyxl-users/KSlPW7xE3Fg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> openpyxl-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Charlie Clark

unread,
Jul 21, 2014, 4:40:30 PM7/21/14
to openpyx...@googlegroups.com
Am .07.2014, 22:36 Uhr, schrieb Pete Douma <pdo...@adops.com>:

> I tried to copy a spreadsheet that has two shapes. One is a dashed line
> and the other is a rounded rectangle. Its definitely a shape because it
> does not copy, so I figure I have to use openpyxl to draw new ones.

Short answer: you can't.

Drawings are not part of the Excel specification. We support them only as
much as they are used when adding charts.

What you *might* be able to do (and is possible for other things we don't
(yet) support like Pivot tables) is to identify the relevant XML files and
associated meta-data when opening a file and make sure you save them with
the file. This is how we preserve VisualBasic macros.

John Bovey

unread,
Jul 22, 2014, 2:22:57 AM7/22/14
to openpyx...@googlegroups.com
Have you tried loading the workbook with keep_vba=true?

John
--
Sent from my Android tablet with K-9 Mail.

Pete Douma

unread,
Jul 22, 2014, 11:38:57 AM7/22/14
to openpyx...@googlegroups.com
Thanks. Can I use a Shape class within a Chart()


----- Original Message -----
From: "Charlie Clark" <charli...@clark-consulting.eu>
To: <openpyx...@googlegroups.com>
Sent: Monday, July 21, 2014 4:40 PM
Subject: Re: [openpyxl-users] draw a simple dashed line


Charlie Clark

unread,
Jul 22, 2014, 12:04:30 PM7/22/14
to openpyx...@googlegroups.com
Am .07.2014, 17:38 Uhr, schrieb Pete Douma <pdo...@adops.com>:

> Thanks. Can I use a Shape class within a Chart()

No, and that's the wrong way to think about it. A chart is a specific
drawing object. For other objects you probably want to look at Section
21.4 of the specification. Charts essentially only support data-like
objects.

If you examine the source a sample file it *might* make things a little
clearer.
Reply all
Reply to author
Forward
0 new messages