数式エディタで記述されたオブジェクトがある場合、少し工夫が必要。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 通常の文字列 | |
int para_cnt = document.Paragraphs.Count; | |
for (int para_index = 1; para_index <= para_cnt; para_index++) | |
{ | |
Range rng = document.Paragraphs[para_index].Range; | |
document.Paragraphs[para_index].Format.BaseLineAlignment = WdBaselineAlignment.wdBaselineAlignCenter; | |
// 選択 | |
rng.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; | |
rng.Select(); | |
} | |
// 数式エディタで記載したオブジェクトがある場合 | |
OMaths maths = document.OMaths; | |
foreach (OMath math in maths) { | |
math.ParentOMath.Justification = WdOMathJc.wdOMathJcCenterGroup; | |
} |
0 件のコメント:
コメントを投稿