procedure TPageSetupForm.PageSetupInit;
var
IniFile: TIniFile;
begin
IniFile:=TIniFile.Create(MainDir+'/config.ini');
try
IniFile.WriteString('PageSetup', 'PageStyle', DefaultPageStyle);
IniFile.WriteInteger('PageSetup', 'PageWidth', DefaultPageWidth);
IniFile.WriteInteger('PageSetup', 'PageHeight', DefaultPageHeight);
IniFile.WriteInteger('PageSetup', 'Orientation', DefaultOrientation);
IniFile.WriteInteger('PageSetup', 'TopMargin', DefaultTopMargin);
IniFile.WriteInteger('PageSetup', 'BottomMargin', DefaultBottomMargin);
IniFile.WriteInteger('PageSetup', 'LeftMargin', DefaultLeftMargin);
IniFile.WriteInteger('PageSetup', 'RightMargin', DefaultRightMargin);
IniFile.WriteInteger('PageSetup', 'FooterMargin', DefaultFooterMargin);
IniFile.WriteInteger('PageSetup', 'CovOffsetRightSpace', DefaultCovOffsetRightSpace);
IniFile.WriteInteger('PageSetup', 'CovOffsetBottomSpace', DefaultCovOffsetBottomSpace);
IniFile.WriteInteger('PageSetup', 'CovRowSpace', DefaultCovRowSpace);
IniFile.WriteBool('PageSetup', 'CovPrnSelPrjChief', DefaultCovPrnSelPrjChief);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditChief', DefaultCovPrnSelEditChief);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditAssessor', DefaultCovPrnSelEditAssessor);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditor', DefaultCovPrnSelEditor);
IniFile.WriteInteger('PageSetup', 'MattMaxRowCount', DefaultMattMaxRowCount);
IniFile.WriteInteger('PageSetup', 'MattRowMaxCharCount', DefaultMattRowMaxCharCount);
//DefaultDrawLineCharCount=56;
IniFile.WriteInteger('PageSetup', 'NoWidth', DefaultNoWidth);
IniFile.WriteInteger('PageSetup', 'ItemNameWidth', DefaultItemNameWidth);
IniFile.WriteInteger('PageSetup', 'MetricUnitWidth', DefaultMetricUnitWidth);
IniFile.WriteInteger('PageSetup', 'WorkAmountWidth', DefaultWorkAmountWidth);
IniFile.WriteInteger('PageSetup', 'UnitPriceWidth', DefaultUnitPriceWidth);
IniFile.WriteInteger('PageSetup', 'ValueWidth', DefaultValueWidth);
//IniFile.WriteInteger('PageSetup', 'PriceWidth', DefaultPriceWidth);
//IniFile.WriteInteger('PageSetup', 'ProPortionWidth', DefaultProPortionWidth);
IniFile.WriteInteger('PageSetup', 'RemarkWidth', DefaultRemarkWidth);
finally
IniFile.Free;
end;
end;
procedure TPageSetupForm.WriteDefaultPageSetupFromVariableToIniFile;
var
IniFile: TIniFile;
begin
IniFile:=TIniFile.Create(MainDir+'/config.ini');
try
IniFile.WriteInteger('PageSetup', 'MattMaxRowCount', nMattMaxRowCount);
IniFile.WriteInteger('PageSetup', 'MattRowMaxCharCount', nMattRowMaxCharCount);
IniFile.WriteInteger('PageSetup', 'TopMargin', nTopMargin);
IniFile.WriteInteger('PageSetup', 'BottomMargin', nBottomMargin);
IniFile.WriteInteger('PageSetup', 'LeftMargin', nLeftMargin);
IniFile.WriteInteger('PageSetup', 'RightMargin', nRightMargin);
IniFile.WriteInteger('PageSetup', 'FooterMargin', nFooterMargin);
IniFile.WriteString('PageSetup', 'PageStyle', sPageStyle);
IniFile.WriteInteger('PageSetup', 'PageWidth', nPageWidth);
IniFile.WriteInteger('PageSetup', 'PageHeight', nPageHeight);
IniFile.WriteInteger('PageSetup', 'Orientation', nOrientation);
IniFile.WriteInteger('PageSetup', 'NoWidth', nNoWidth);
IniFile.WriteInteger('PageSetup', 'ItemNameWidth', nItemNameWidth);
IniFile.WriteInteger('PageSetup', 'MetricUnitWidth', nMetricUnitWidth);
IniFile.WriteInteger('PageSetup', 'WorkAmountWidth', nWorkAmountWidth);
IniFile.WriteInteger('PageSetup', 'UnitPriceWidth', nUnitPriceWidth);
IniFile.WriteInteger('PageSetup', 'ValueWidth', nValueWidth);
//IniFile.WriteInteger('PageSetup', 'PriceWidth', nPriceWidth);
//IniFile.WriteInteger('PageSetup', 'ProPortionWidth', nProPortionWidth);
IniFile.WriteInteger('PageSetup', 'RemarkWidth', nRemarkWidth);
IniFile.WriteInteger('PageSetup', 'CovOffsetRightSpace', nCovOffsetRightSpace);
IniFile.WriteInteger('PageSetup', 'CovOffsetBottomSpace', nCovOffsetBottomSpace);
IniFile.WriteInteger('PageSetup', 'CovRowSpace', nCovRowSpace);
IniFile.WriteBool('PageSetup', 'CovPrnSelPrjChief', fCovPrnSelPrjChief);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditChief', fCovPrnSelEditChief);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditAssessor', fCovPrnSelEditAssessor);
IniFile.WriteBool('PageSetup', 'CovPrnSelEditor', fCovPrnSelEditor);
finally
IniFile.Free;
end;
end;
以上程序在我的软件“房地产开发估价管理系统”中实现。下载地地址:http://www.softreg.com.cn/shareware_view.asp?id=/9DE34D01-6F82-4927-8408-4B111C1D2C48/
不过现在在win2k/xp下纸张设置有问题,正在改正。
我还做到了每个项目一个打印设置,具体做法是将打印设置的数据写到每个项目的数据库里去。