Book a Demo

Author Topic: Programatically change fonts in a diagram  (Read 5189 times)

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Programatically change fonts in a diagram
« on: February 18, 2016, 02:50:07 am »
Hi guys,

Is there a way to change the font size of elements in a diagram via the API? The DiagramObject.Style setting does not seem to cover this, at least not according to Thomas' book.

Cheers
Knut

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Programatically change fonts in a diagram
« Reply #1 on: February 18, 2016, 07:24:12 am »
A quick look reveals that t_diagramobject.style holds fontsz=<sz10>; where <sz10> is 10 times the chosen font size.

I'll have a look how to set that via API.

q.

P.S. You can change DiagramObject.Style like this (Perl script):
Code: [Select]
my $dia = $rep->GetDiagramByGuid("{3652C181-7123-42f6-84CF-106ECE5F3C34}");
my $do = $dia->diagramObjects->GetAt(0);
$do->{Style} = "font=Arial;fontsz=150;bold=0;black=0;italic=0;ul=0;charset=0;pitch=34;BFol=0;";
$do->Update();
sets the font size for the one element to 15pt.
« Last Edit: February 18, 2016, 07:29:47 am by qwerty »

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Re: Programatically change fonts in a diagram
« Reply #2 on: February 18, 2016, 05:54:42 pm »
Thanks :-)
I'll give it a try.

cheers
Knut