Page 1 of 1

Still having problems to save and load text and para styles

Posted: Fri Oct 20, 2006 7:31 pm
by VT
I'm still having problems to save and load text and paragraph styles to a IniFile.
I have tried this code to save:

ini := TiniFile.create(ExtractFilePath(ApplicationExeName) + 'Font.ini');
try
textstyle.savetoIni(ini, 'font', 'fontP');
finally
ini.free;
end;

And this code to load:

ini := TiniFile.create(ExtractFilePath(ApplicationExeName) + 'Font.ini');
try
textstyle[0].loadfromIni(ini, 'font', 'fontP', false, 101);
finally
ini.free;
end;

When it is loaded the whole style becomes weird.
Can someone help me on this problem, please ?

Posted: Sat Oct 21, 2006 8:09 pm
by Sergey Tkachenko
You want to save and load a single text style?

The third parameter must contain '%s'. For example,
textstyle.savetoIni(ini, 'font', 'font%s');
The same for loadfromini.

Posted: Tue Oct 24, 2006 3:52 pm
by VT
Thanks Sergey, it worked.