Book a Demo

Author Topic: Element name wraps when a dash is present  (Read 4629 times)

xohmg

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Element name wraps when a dash is present
« on: September 01, 2016, 05:22:45 am »
We recently upgrade to version 12 and all of our diagrams are now not showing properly. Almost all of our element names have dashes in them and when they do, it wraps after the dashes if it overflows the width of the element.

I've tried setting the ctrl+shift+y properties "When Resizing Elements" Resize to longest Feature but this doesn't work.

Any ideas?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element name wraps when a dash is present
« Reply #1 on: September 01, 2016, 06:27:27 am »
As written on SO, you need to resize per script. No idea how to calculate the width of a string on Windoze (probably you approximate it width some constant width). You need to run a script like

Code: [Select]
dia = repository.GetDiagram.... # load the diagram
for do in dia.diagramObjects {
  e = repository.getElementById(do.ElementId)
  width = stringBitWidth(e.Name) # calc width of text in screen pixels; use your phantasy
  currWidth = do.right - do.left
  extend = (width - currWidth) / 2
  do.Left -= extend
  do.Right += extend
  do.Update()
}

q.
« Last Edit: September 01, 2016, 06:30:15 am by qwerty »