本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
================

注会练习软件
http://www.cpasoft.com.cn
我的注会软件官网

http://blog.163.com/abc7105@126/

 

 


哈哈,热爱快“过气”的DELPHI


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:注册会计师(注会)练习软件
日志总数:398
评论数量:116
留言数量:27
访问次数:3265582
建立时间:2005年6月6日




[delpih编程]delphi 为word文档增加一个段落样式
软件技术

吕向阳 发表于 2011/4/10 21:32:30

下为程序中的一段,解决了为文档增加一个段落样式。这个段落样式的基础样式为“标题2”,标题字体、字号重设了,关键是设了自动编号的功能。procedure TForm1.titlestyle(wordapp: variant);begin  try //   wordapp.ActiveDocument.Styles.item('自定标题').Delete;  except  end;  wordapp.ActiveDocument.Styles.Add(Name := '自定标题', type := wdStyleTypeParagraph);  wordapp.ActiveDocument.Styles.item('自定标题').AutomaticallyUpdate := False;  wordapp.ActiveDocument.Styles.item('自定标题').AutomaticallyUpdate := False;  wordapp.ActiveDocument.Styles.item('自定标题').BaseStyle := '标题 2 ';  wordapp.ActiveDocument.Styles.item('自定标题').Font.NameFarEast := ' + 中文标题';  wordapp.ActiveDocument.Styles.item('自定标题').Font.NameAscii := ' + 西文标题'; // wordapp.ActiveDocument.Styles.item('自定标题').Font.NameOther := ' + 西文标题';  wordapp.ActiveDocument.Styles.item('自定标题').Font.Name := ' + 西文标题';  wordapp.ActiveDocument.Styles.item('自定标题').Font.Size := 10.5;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Bold := True;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Italic := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Underline := wdUnderlineNone;  wordapp.ActiveDocument.Styles.item('自定标题').Font.UnderlineColor := wdColorAutomatic;  wordapp.ActiveDocument.Styles.item('自定标题').Font.StrikeThrough := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.DoubleStrikeThrough := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Outline := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Emboss := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Shadow := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Hidden := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.SmallCaps := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.AllCaps := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Color := wdColorAutomatic;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Engrave := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Superscript := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Subscript := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Scaling := 100;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Kerning := 0;  wordapp.ActiveDocument.Styles.item('自定标题').Font.Animation := wdAnimationNone;  wordapp.ActiveDocument.Styles.item('自定标题').Font.DisableCharacterSpaceGrid := False;  wordapp.ActiveDocument.Styles.item('自定标题').Font.EmphasisMark := wdEmphasisMarkNone;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.LeftIndent := CentimetersToPoints(0.74);  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.RightIndent := CentimetersToPoints(0);  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.SpaceBefore := 6;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.SpaceBeforeAuto := False;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.SpaceAfter := 6;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.SpaceAfterAuto := False;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.LineSpacingRule := wdLineSpace1pt5;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.Alignment := wdAlignParagraphLeft;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.WidowControl := True;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.KeepWithNext := True;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.KeepTogether := True;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.PageBreakBefore := False;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.NoLineNumber := False;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.Hyphenation := True;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.FirstLineIndent := CentimetersToPoints(-0.74);  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.OutlineLevel := wdOutlineLevel1;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.CharacterUnitLeftIndent := 0;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.CharacterUnitRightIndent := 0;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.CharacterUnitFirstLineIndent := 0;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.LineUnitBefore := 0;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.LineUnitAfter := 0;  wordapp.ActiveDocument.Styles.item('自定标题').ParagraphFormat.BaseLineAlignment := wdBaselineAlignAuto;  wordapp.ActiveDocument.Styles.item('自定标题').NoSpaceBetweenParagraphsOfSameStyle := False;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).NumberFormat := '%1.';  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).TrailingCharacter := wdTrailingTab;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).NumberStyle := wdListNumberStyleArabic;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).NumberPosition := CentimetersToPoints(0);  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Alignment := wdListLevelAlignLeft;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).TextPosition := CentimetersToPoints(0.74);  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).TabPosition := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).ResetOnHigher := 0;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).StartAt := 1;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Bold := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Italic := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.StrikeThrough := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Subscript := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Superscript := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Shadow := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Outline := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Emboss := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Engrave := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.AllCaps := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Hidden := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Underline := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Color := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Size := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Animation := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.DoubleStrikeThrough := wdUndefined;  wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1).ListLevels.item(1).Font.Name := ''; // wordapp.ListGalleries.item(wdNumberGallery).LinkedStyle := '自定标题';  wordapp.ActiveDocument.Styles.item('自定标题').LinkToListTemplate(ListTemplate := wordapp.ListGalleries.item(wdNumberGallery).ListTemplates.item(1), ListLevelNumber := 1);end;


阅读全文(1189) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.278 second(s), page refreshed 144772464 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号