Skip to content

Instantly share code, notes, and snippets.

@hnq90
Created June 26, 2015 07:22
Show Gist options
  • Select an option

  • Save hnq90/764b117e2b9bb03be85a to your computer and use it in GitHub Desktop.

Select an option

Save hnq90/764b117e2b9bb03be85a to your computer and use it in GitHub Desktop.
# This is a short cut method to set the start anchor position
# If you need finer granularity in positioning use
# graphic_frame.anchor.from.colOff / rowOff
# @param [Integer] x The column
# @param [Integer] y The row
# @return [Marker]
def start_at(x, y=0)
x, y = *parse_coord_args(x, y)
@graphic_frame.anchor.from.col = x
@graphic_frame.anchor.from.row = y
end
# This is a short cut method to set the end anchor position
# If you need finer granularity in positioning use
# graphic_frame.anchor.to.colOff / rowOff
# @param [Integer] x The column
# @param [Integer] y The row
# @return [Marker]
def end_at(x, y=0)
x, y = *parse_coord_args(x, y)
@graphic_frame.anchor.to.col = x
@graphic_frame.anchor.to.row = y
end
# If you want to put the image more accurately, use
# colOff = column Offset
# rowOff = row Offset
# x1,x2 = integer (EMU unit) (https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/)
# y1,y2, same x1,x2
# Start point
graphic_frame.anchor.from.colOff = x1
graphic_frame.anchor.from.rowOff = y1
# End point
graphic_frame.anchor.to.colOff = x2
graphic_frame.anchor.to.rowOff = y2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment