poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bengt Rodehav <be...@rodehav.com>
Subject Re: Set comment width in pixels
Date Mon, 13 Jun 2016 08:16:11 GMT
Hi Mark,

I did look at the XML for the drawing associated with the comment. It looks
somesting like this

<xml xmlns:v="urn:schemas-microsoft-com:vml"
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600"
  <v:stroke joinstyle="miter"/>
  <v:path gradientshapeok="t" o:connecttype="rect"/>
 </v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t202"
  visibility:visible;mso-wrap-style:tight' fillcolor="#ffffe1"
  <v:fill color2="#ffffe1"/>
  <v:shadow color="black" obscured="t"/>
  <v:path o:connecttype="none"/>
  <v:textbox style='mso-direction-alt:auto'>
   <div style='text-align:left'></div>
  <x:ClientData ObjectType="Note">
    1, 15, 0, 2, 17, 61, 8, 14</x:Anchor>

There is a with as an attribute to the <shape> element. It seems correct
but changing it doesn't help. It's the values in the <anchor> element that
seems to determine the size. The width attribute is then updated to
whatever is calculated using the <anchor>.

I'm really not an Excel expert so I'm not the right person to solve this.
There also seems to be a large number of comments about Excel bugs
regarding sizing (and positioning) of comments when I google the subject.

To me it appears like the only way to set the width of a comment (in
pixels) is to first calculate how many columns must be spanned and then
adding a little extra offset in the last column for the anchor. To make
this work I then need to be able to convert between pixels and whatever
unit the anchor uses (I found the class org.apache.poi.util.Units which I
assume can help me with that) and also to determine the column widths in
some kind of convertable unit.

I can then create an anchor with a certain width i pixels. Hopefully that


2016-06-10 16:38 GMT+02:00 Mark Beardsley <markbrdsly@tiscali.co.uk>:

> Why not try it to find out what information is stored in the file - the xml
> based .xlsx file format would be best for this.
> Looking at
> https://support.office.com/en-us/article/Annotate-a-worksheet-by-using-comments-3b7065dd-531a-4ffe-8f18-8d047a6ccae7#bm4
> it is certainly possible to resize a comment. Knowing this, I would create
> a
> workbook with a worksheet that has a comment on a single cell and then save
> this away. Resize the comment and save the workbook away again under a
> different name. Unzip both and look to see what information is stored in
> the
> files and how they differ one from the other. This should point to the
> areas
> of the xml markup that need to be addressed and they can then be exposed
> through the api.
> Once you know how the size of the comment can be specified, it might then
> be
> possible to move on to setting those dimensions using pixels as the unit.
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Set-comment-width-in-pixels-tp5723247p5723321.html
> Sent from the POI - User mailing list archive at Nabble.com.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message