com.extentech.ExtenXLS
Class CommentHandle

java.lang.Object
  extended by com.extentech.ExtenXLS.CommentHandle
All Implemented Interfaces:
Handle

public class CommentHandle
extends Object
implements Handle

 CommentHandle allows for manipulation of the Note or Comment feature of Excel
 
 In order to create CommentHandles programatically use the methods in WorkSheetHandle or CellHandle
 
 

Author:
kaia:: [ April 13, 2010 ] :: Copyright ©2011Extentech Inc.

Method Summary
 String getAddress()
          Returns the address this Note (Comment) is attached to
 String getAuthor()
          returns the author of this Note (Comment) if set
 int getColNum()
          return the Column this note is attached to
 String getCommentText()
          Returns the text of the Note (Comment)
 com.extentech.formats.XLS.Note getInternalNoteRec()
          Returns the internal note record for this CommentHandle.
 boolean getIsHidden()
          Returns true if this Note (Comment) is hidden until focus
 String getOOXML(int authId)
          Returns the OOXML representation of this Note object
 int getRowNum()
          return the Row number (0-based) this Note is attached to
 short[] getTextBoxBounds()
          returns the bounds (size and position) of the Text Box for this Note
bounds are relative and based upon rows, columns and offsets within
bounds are as follows:
bounds[0]= column # of top left position (0-based) of the shape
bounds[1]= x offset within the top-left column (0-1023)
bounds[2]= row # for top left corner
bounds[3]= y offset within the top-left corner (0-1023)
bounds[4]= column # of the bottom right corner of the shape
bounds[5]= x offset within the cell for the bottom-right corner (0-1023)
bounds[6]= row # for bottom-right corner of the shape
bounds[7]= y offset within the cell for the bottom-right corner (0-1023)
 void hide()
          Sets this Note (Comment) to be hidden until the attached cell has focus This is the default state of note records
 void remove()
          Removes or deletes this Note (Comment) from the worksheet
 void setAuthor(String author)
          sets the author of this Note (Comment)
 void setCommentText(String text)
          Sets the text of the Note (Comment).
 void setRowCol(int row, int col)
          Sets this Note (Comment) to be attached to a cell at [row, col]
 void setTextBoxBounds(short[] bounds)
          Sets the bounds (size and position) of the Text Box for this Note
bounds are relative and based upon rows, columns and offsets within
bounds are as follows:
bounds[0]= column # of top left position (0-based) of the shape
bounds[1]= x offset within the top-left column (0-1023)
bounds[2]= row # for top left corner
bounds[3]= y offset within the top-left corner (0-1023)
bounds[4]= column # of the bottom right corner of the shape
bounds[5]= x offset within the cell for the bottom-right corner (0-1023)
bounds[6]= row # for bottom-right corner of the shape
bounds[7]= y offset within the cell for the bottom-right corner (0-1023)
 void setTextBoxSize(int width, int height)
          Sets the width and height of the bounding text box of the note
Units are in pixels
NOTE: the height algorithm w.r.t.
 void show()
          Sets this Note (Comment) to always show, even when the attached cell loses focus
 String toString()
          return the String representation of this CommentHandle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCommentText

public String getCommentText()
Returns the text of the Note (Comment)

Returns:
String value or text of Note

setCommentText

public void setCommentText(String text)
Sets the text of the Note (Comment).

The text may contain embedded formatting information as follows:
< font specifics>text segment< font specifics for next segment>text segment...
where font specifics can be one or more of (all are optional):


getAuthor

public String getAuthor()
returns the author of this Note (Comment) if set

Returns:
String author

setAuthor

public void setAuthor(String author)
sets the author of this Note (Comment)

Parameters:
author -

remove

public void remove()
Removes or deletes this Note (Comment) from the worksheet


show

public void show()
Sets this Note (Comment) to always show, even when the attached cell loses focus


hide

public void hide()
Sets this Note (Comment) to be hidden until the attached cell has focus This is the default state of note records


getIsHidden

public boolean getIsHidden()
Returns true if this Note (Comment) is hidden until focus

Returns:

setRowCol

public void setRowCol(int row,
                      int col)
Sets this Note (Comment) to be attached to a cell at [row, col]

Parameters:
row - int row number (0-based)
col - int column number (0-based)

getAddress

public String getAddress()
Returns the address this Note (Comment) is attached to

Returns:
String Cell Address

toString

public String toString()
return the String representation of this CommentHandle

Overrides:
toString in class Object

getRowNum

public int getRowNum()
return the Row number (0-based) this Note is attached to

Returns:
0-based row number

getColNum

public int getColNum()
return the Column this note is attached to

Returns:
Column number as an integer e.g. A=0, B=1 ...

setTextBoxSize

public void setTextBoxSize(int width,
                           int height)
Sets the width and height of the bounding text box of the note
Units are in pixels
NOTE: the height algorithm w.r.t. varying row heights is not 100%

Parameters:
width - short desired text box width in pixels
height - short desired text box height in pixels

getTextBoxBounds

public short[] getTextBoxBounds()
returns the bounds (size and position) of the Text Box for this Note
bounds are relative and based upon rows, columns and offsets within
bounds are as follows:
bounds[0]= column # of top left position (0-based) of the shape
bounds[1]= x offset within the top-left column (0-1023)
bounds[2]= row # for top left corner
bounds[3]= y offset within the top-left corner (0-1023)
bounds[4]= column # of the bottom right corner of the shape
bounds[5]= x offset within the cell for the bottom-right corner (0-1023)
bounds[6]= row # for bottom-right corner of the shape
bounds[7]= y offset within the cell for the bottom-right corner (0-1023)

Returns:

setTextBoxBounds

public void setTextBoxBounds(short[] bounds)
Sets the bounds (size and position) of the Text Box for this Note
bounds are relative and based upon rows, columns and offsets within
bounds are as follows:
bounds[0]= column # of top left position (0-based) of the shape
bounds[1]= x offset within the top-left column (0-1023)
bounds[2]= row # for top left corner
bounds[3]= y offset within the top-left corner (0-1023)
bounds[4]= column # of the bottom right corner of the shape
bounds[5]= x offset within the cell for the bottom-right corner (0-1023)
bounds[6]= row # for bottom-right corner of the shape
bounds[7]= y offset within the cell for the bottom-right corner (0-1023)


getInternalNoteRec

public com.extentech.formats.XLS.Note getInternalNoteRec()
Returns the internal note record for this CommentHandle. Be aware that this note record should not be modified directly, and that this method is only for internal application use.

Returns:
Name record

getOOXML

public String getOOXML(int authId)
Returns the OOXML representation of this Note object

Parameters:
authId - 0-based author index for the author linked to this Note
Returns:
String OOMXL representation


Copyright © 2011 Extentech Inc. All Rights Reserved.