Word.Font class
フォントを表します。
- Extends
注釈
使用元
- Word.本文: font
- Word.ConditionalStyle: font
- Word.ContentControl: font
- Word.一覧: getLevelFont
- Word.ListLevel: font
- Word.段落:フォント
- Word.範囲: font
- Word.選択:フォント
- Word.スタイル: font
- Word.テーブル: フォント
- Word.TableRow: font
例
// Change the font color
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to change the font color of the current selection.
selection.font.color = 'blue';
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The font color of the selection has been changed.');
});
プロパティ
| all |
フォントをすべて大文字として書式設定するかどうかを指定します。つまり、小文字は大文字として表示されます。 次の値が示される可能性があります。
|
| bold | フォントを太字にするかどうかを指定します。
|
| bold |
右から左の言語ドキュメントでフォントを太字として書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| borders | フォントのすべての罫線を表す |
| color | フォントの色を指定します。 値は '#RRGGBB' 形式または色名で指定できます。 |
| color |
フォントの色を表す |
| color |
右から左に記述する言語ドキュメントの |
| context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
| contextual |
フォントに対してコンテキスト代替を有効にするかどうかを指定します。 |
| diacritic |
|
| disable |
対応する |
| double |
フォントに取り消し線を付けるかどうかを指定します。
|
| emboss | フォントをエンボス加工として書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| emphasis |
文字または指定文字列の強調記号を表す |
| engrave | フォントを彫刻として書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| fill | テキスト範囲で使用されるフォントの塗りつぶしの書式設定プロパティが含まれる |
| glow | テキスト範囲で使用されるフォントの光彩書式を表す |
| hidden | フォントに非表示としてタグ付けするかどうかを指定します。
|
| highlight |
ハイライト カラーを指定します。 設定するには、'#RRGGBB' 形式または色名の値を使用します。 ハイライト カラーを削除するには、[ |
| italic | フォントを斜体にするかどうかを指定します。
|
| italic |
右から左の言語ドキュメントでフォントを斜体にするかどうかを指定します。 次の値が示される可能性があります。
|
| kerning | Microsoft Word がカーニングを自動的に調整する最小フォント サイズを指定します。 |
| ligature |
|
| line | 行の書式を指定する |
| name | フォントの名前を指定します。 |
| name |
ラテン文字のテキスト (文字コードが 0 から 127 までの文字) に使用されるフォントを指定します。 |
| name |
右から左に記述する言語ドキュメントのフォント名を指定します。 |
| name |
東アジア言語のフォント名を指定します。 |
| name |
128 から 255 までのコードを持つ文字に使用するフォントを指定します。 |
| number |
OpenType フォントの数字の書式設定を指定します。 |
| number |
フォントの番号間隔の設定を指定します。 |
| outline | フォントをアウトラインとして書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| position | 基準行に対するテキストの位置をポイント単位で指定します。 |
| reflection | 図形のリフレクション書式を表す |
| scaling | フォントに適用されるスケーリングのパーセンテージを指定します。 |
| shadow | フォントを影付きとして書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| size | フォント サイズをポイント単位で指定します。 |
| size |
右から左に記述するテキストのフォント サイズをポイント単位で指定します。 |
| small |
小文字が小文字として表示されるように、フォントを小文字として書式設定するかどうかを指定します。 次の値が示される可能性があります。
|
| spacing | 文字間の間隔を指定します。 |
| strike |
フォントに取り消し線を使用するかどうかを指定します。
|
| stylistic |
フォントのスタイル セットを指定します。 |
| subscript | フォントが下付き文字であるかどうかを指定します。
|
| superscript | フォントを上付き文字にするかどうかを指定します。
|
| text |
フォントの色を表す |
| text |
フォントの影の書式を指定する |
| three |
フォントの 3 次元 (3D) 効果の書式設定プロパティを含む |
| underline | フォントの下線の種類を指定します。
|
| underline |
|
メソッド
| decrease |
フォント サイズを次に使用可能な大きさまで縮小します。 |
| increase |
選択されている文字列のフォント サイズを、現在のプリンターで使用可能な次の大きさまで拡大します。 |
| load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| reset() | 手動での文字書式設定を削除します。 |
| set(properties, options) | オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクト、または同じ型の別の API オブジェクトを渡すことができます。 |
| set(properties) | 既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。 |
| set |
指定されたフォント書式を、作業中の文書および現在使用しているテンプレートを使って作成する新規文書の既定のフォント書式として設定します。 |
| toJSON() | API オブジェクトが |
| track() | ドキュメントの環境変更に基づいて自動的に調整する目的でオブジェクトを追跡します。 この呼び出しは、 context.trackedObjects.add(thisObject) の短縮形です。 このオブジェクトを |
| untrack() | 前に追跡されていた場合、このオブジェクトに関連付けられているメモリを解放します。 この呼び出しは、 context.trackedObjects.remove(thisObject) の省略形です。 追跡対象オブジェクトが多いとホスト アプリケーションの動作が遅くなります。追加したオブジェクトが不要になったら、必ずそれを解放してください。 メモリ リリースを有効にする前に、 |
プロパティの詳細
allCaps
フォントをすべて大文字として書式設定するかどうかを指定します。つまり、小文字は大文字として表示されます。 次の値が示される可能性があります。
true: すべてのテキストに All Caps 属性があります。false: いずれのテキストにも All Caps 属性がありません。null: テキストのすべてではなく一部に All Caps 属性がある場合は返されます。
allCaps: boolean;
プロパティ値
boolean
注釈
bold
フォントを太字にするかどうかを指定します。
true フォントが太字で書式設定されている場合は太字で、それ以外の場合は false。
bold: boolean;
プロパティ値
boolean
注釈
例
// Bold format text
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to make the current selection bold.
selection.font.bold = true;
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The selection is now bold.');
});
boldBidirectional
右から左の言語ドキュメントでフォントを太字として書式設定するかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストが太字で表示されます。false: 太字のテキストはありません。null: テキストのすべてではなく一部が太字の場合に返されます。
boldBidirectional: boolean;
プロパティ値
boolean
注釈
borders
フォントのすべての罫線を表す BorderUniversalCollection オブジェクトを返します。
readonly borders: Word.BorderUniversalCollection;
プロパティ値
注釈
color
フォントの色を指定します。 値は '#RRGGBB' 形式または色名で指定できます。
color: string;
プロパティ値
string
注釈
例
// Change the font color
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to change the font color of the current selection.
selection.font.color = 'blue';
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The font color of the selection has been changed.');
});
colorIndex
フォントの色を表す ColorIndex 値を指定します。
colorIndex: Word.ColorIndex | "Auto" | "Black" | "Blue" | "Turquoise" | "BrightGreen" | "Pink" | "Red" | "Yellow" | "White" | "DarkBlue" | "Teal" | "Green" | "Violet" | "DarkRed" | "DarkYellow" | "Gray50" | "Gray25" | "ClassicRed" | "ClassicBlue" | "ByAuthor";
プロパティ値
Word.ColorIndex | "Auto" | "Black" | "Blue" | "Turquoise" | "BrightGreen" | "Pink" | "Red" | "Yellow" | "White" | "DarkBlue" | "Teal" | "Green" | "Violet" | "DarkRed" | "DarkYellow" | "Gray50" | "Gray25" | "ClassicRed" | "ClassicBlue" | "ByAuthor"
注釈
colorIndexBidirectional
右から左に記述する言語ドキュメントの Font オブジェクトの色を指定します。
colorIndexBidirectional: Word.ColorIndex | "Auto" | "Black" | "Blue" | "Turquoise" | "BrightGreen" | "Pink" | "Red" | "Yellow" | "White" | "DarkBlue" | "Teal" | "Green" | "Violet" | "DarkRed" | "DarkYellow" | "Gray50" | "Gray25" | "ClassicRed" | "ClassicBlue" | "ByAuthor";
プロパティ値
Word.ColorIndex | "Auto" | "Black" | "Blue" | "Turquoise" | "BrightGreen" | "Pink" | "Red" | "Yellow" | "White" | "DarkBlue" | "Teal" | "Green" | "Violet" | "DarkRed" | "DarkYellow" | "Gray50" | "Gray25" | "ClassicRed" | "ClassicBlue" | "ByAuthor"
注釈
context
オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。
context: RequestContext;
プロパティ値
contextualAlternates
フォントに対してコンテキスト代替を有効にするかどうかを指定します。
contextualAlternates: boolean;
プロパティ値
boolean
注釈
diacriticColor
Font オブジェクトの Diacritic に使用する色を指定します。 値は '#RRGGBB' 形式で指定できます。
diacriticColor: string;
プロパティ値
string
注釈
disableCharacterSpaceGrid
対応する Font オブジェクトの 1 行あたりの文字数を Microsoft Word が無視するかどうかを指定します。
disableCharacterSpaceGrid: boolean;
プロパティ値
boolean
注釈
doubleStrikeThrough
フォントに取り消し線を付けるかどうかを指定します。
true フォントが取り消し線テキストとして書式設定されている場合は、それ以外の場合は false。
doubleStrikeThrough: boolean;
プロパティ値
boolean
注釈
emboss
フォントをエンボス加工として書式設定するかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストがエンボス加工されています。false: どのテキストもエンボス加工されていません。null: テキストのすべてではなく一部がエンボス加工されている場合は返されます。
emboss: boolean;
プロパティ値
boolean
注釈
emphasisMark
文字または指定文字列の強調記号を表す EmphasisMark 値を指定します。
emphasisMark: Word.EmphasisMark | "None" | "OverSolidCircle" | "OverComma" | "OverWhiteCircle" | "UnderSolidCircle";
プロパティ値
Word.EmphasisMark | "None" | "OverSolidCircle" | "OverComma" | "OverWhiteCircle" | "UnderSolidCircle"
注釈
engrave
フォントを彫刻として書式設定するかどうかを指定します。 次の値が示される可能性があります。
true:すべてのテキストが刻印されます。false: テキストは刻印されません。null: テキストのすべてではなく一部が刻印されている場合は返されます。
engrave: boolean;
プロパティ値
boolean
注釈
fill
テキスト範囲で使用されるフォントの塗りつぶしの書式設定プロパティが含まれる FillFormat オブジェクトを返します。
readonly fill: Word.FillFormat;
プロパティ値
注釈
glow
テキスト範囲で使用されるフォントの光彩書式を表す GlowFormat オブジェクトを返します。
readonly glow: Word.GlowFormat;
プロパティ値
注釈
hidden
フォントに非表示としてタグ付けするかどうかを指定します。
true フォントが隠しテキストとして書式設定されている場合は、それ以外の場合は false。
hidden: boolean;
プロパティ値
boolean
注釈
highlightColor
ハイライト カラーを指定します。 設定するには、'#RRGGBB' 形式または色名の値を使用します。 ハイライト カラーを削除するには、[ null] に設定します。 返されるハイライト カラーは、'#RRGGBB' 形式、混合ハイライト カラーの場合は空文字列、ハイライト カラーがない場合は null にすることができます。 注: Office for Windows デスクトップでは、既定の強調表示色のみを使用できます。 これらは、"Yellow"、"Lime"、"Turquoise"、"Pink"、"Blue"、"Red"、"DarkBlue"、"Teal"、"Green"、"Purple"、"DarkRed"、"Olive"、"Gray"、"LightGray"、"Black" です。 Office for Windows デスクトップでアドインを実行すると、その他の色がフォントに適用されると、最も近い色に変換されます。
highlightColor: string;
プロパティ値
string
注釈
例
// Highlight selected text
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to highlight the current selection.
selection.font.highlightColor = '#FFFF00'; // Yellow
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The selection has been highlighted.');
});
italic
フォントを斜体にするかどうかを指定します。
true フォントが斜体の場合は斜体、それ以外の場合は false。
italic: boolean;
プロパティ値
boolean
注釈
italicBidirectional
右から左の言語ドキュメントでフォントを斜体にするかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストが斜体になります。false: どのテキストも斜体ではありません。null: テキストのすべてではなく一部が斜体になっている場合は返されます。
italicBidirectional: boolean;
プロパティ値
boolean
注釈
kerning
Microsoft Word がカーニングを自動的に調整する最小フォント サイズを指定します。
kerning: number;
プロパティ値
number
注釈
ligature
Font オブジェクトの合字設定を指定します。
ligature: Word.Ligature | "None" | "Standard" | "Contextual" | "StandardContextual" | "Historical" | "StandardHistorical" | "ContextualHistorical" | "StandardContextualHistorical" | "Discretional" | "StandardDiscretional" | "ContextualDiscretional" | "StandardContextualDiscretional" | "HistoricalDiscretional" | "StandardHistoricalDiscretional" | "ContextualHistoricalDiscretional" | "All";
プロパティ値
Word.Ligature | "None" | "Standard" | "Contextual" | "StandardContextual" | "Historical" | "StandardHistorical" | "ContextualHistorical" | "StandardContextualHistorical" | "Discretional" | "StandardDiscretional" | "ContextualDiscretional" | "StandardContextualDiscretional" | "HistoricalDiscretional" | "StandardHistoricalDiscretional" | "ContextualHistoricalDiscretional" | "All"
注釈
line
行の書式を指定する LineFormat オブジェクトを返します。
readonly line: Word.LineFormat;
プロパティ値
注釈
name
フォントの名前を指定します。
name: string;
プロパティ値
string
注釈
例
// Change the font name
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to change the current selection's font name.
selection.font.name = 'Arial';
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The font name has changed.');
});
nameAscii
ラテン文字のテキスト (文字コードが 0 から 127 までの文字) に使用されるフォントを指定します。
nameAscii: string;
プロパティ値
string
注釈
nameBidirectional
右から左に記述する言語ドキュメントのフォント名を指定します。
nameBidirectional: string;
プロパティ値
string
注釈
nameFarEast
nameOther
128 から 255 までのコードを持つ文字に使用するフォントを指定します。
nameOther: string;
プロパティ値
string
注釈
numberForm
OpenType フォントの数字の書式設定を指定します。
numberForm: Word.NumberForm | "Default" | "Lining" | "OldStyle";
プロパティ値
Word.NumberForm | "Default" | "Lining" | "OldStyle"
注釈
numberSpacing
フォントの番号間隔の設定を指定します。
numberSpacing: Word.NumberSpacing | "Default" | "Proportional" | "Tabular";
プロパティ値
Word.NumberSpacing | "Default" | "Proportional" | "Tabular"
注釈
outline
フォントをアウトラインとして書式設定するかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストがアウトラインされます。false: テキストの輪郭は表示されません。null: テキストのすべてではなく一部がアウトラインされている場合は返されます。
outline: boolean;
プロパティ値
boolean
注釈
position
reflection
図形のリフレクション書式を表す ReflectionFormat オブジェクトを返します。
readonly reflection: Word.ReflectionFormat;
プロパティ値
注釈
scaling
shadow
フォントを影付きとして書式設定するかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストに影が付きます。false: どのテキストも影になりません。null: テキストのすべてではなく一部がシャドウになっている場合に返されます。
shadow: boolean;
プロパティ値
boolean
注釈
size
フォント サイズをポイント単位で指定します。
size: number;
プロパティ値
number
注釈
例
// Change the font size
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to change the current selection's font size.
selection.font.size = 20;
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The font size has changed.');
});
sizeBidirectional
右から左に記述するテキストのフォント サイズをポイント単位で指定します。
sizeBidirectional: number;
プロパティ値
number
注釈
smallCaps
小文字が小文字として表示されるように、フォントを小文字として書式設定するかどうかを指定します。 次の値が示される可能性があります。
true: すべてのテキストに Small Caps 属性があります。false: どのテキストにも Small Caps 属性がありません。null: テキストのすべてではなく一部に Small Caps 属性がある場合は返されます。
smallCaps: boolean;
プロパティ値
boolean
注釈
spacing
strikeThrough
フォントに取り消し線を使用するかどうかを指定します。
true フォントが取り消し線テキストとして書式設定されている場合は、それ以外の場合は false。
strikeThrough: boolean;
プロパティ値
boolean
注釈
例
// Strike format text
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to strikethrough the font of the current selection.
selection.font.strikeThrough = true;
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The selection now has a strikethrough.');
});
stylisticSet
フォントのスタイル セットを指定します。
stylisticSet: Word.StylisticSet | "Default" | "Set01" | "Set02" | "Set03" | "Set04" | "Set05" | "Set06" | "Set07" | "Set08" | "Set09" | "Set10" | "Set11" | "Set12" | "Set13" | "Set14" | "Set15" | "Set16" | "Set17" | "Set18" | "Set19" | "Set20";
プロパティ値
Word.StylisticSet | "Default" | "Set01" | "Set02" | "Set03" | "Set04" | "Set05" | "Set06" | "Set07" | "Set08" | "Set09" | "Set10" | "Set11" | "Set12" | "Set13" | "Set14" | "Set15" | "Set16" | "Set17" | "Set18" | "Set19" | "Set20"
注釈
subscript
フォントが下付き文字であるかどうかを指定します。
true フォントが下付き文字として書式設定されている場合は、それ以外の場合は false。
subscript: boolean;
プロパティ値
boolean
注釈
superscript
フォントを上付き文字にするかどうかを指定します。
true フォントが上付き文字として書式設定されている場合は false。
superscript: boolean;
プロパティ値
boolean
注釈
textColor
フォントの色を表す ColorFormat オブジェクトを返します。
readonly textColor: Word.ColorFormat;
プロパティ値
注釈
textShadow
フォントの影の書式を指定する ShadowFormat オブジェクトを返します。
readonly textShadow: Word.ShadowFormat;
プロパティ値
注釈
threeDimensionalFormat
フォントの 3 次元 (3D) 効果の書式設定プロパティを含む ThreeDimensionalFormat オブジェクトを返します。
readonly threeDimensionalFormat: Word.ThreeDimensionalFormat;
プロパティ値
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/apply-bevel-to-text.yaml
if (!Office.context.requirements.isSetSupported("WordApiDesktop", "1.3")) {
console.error("This sample requires WordApiDesktop 1.3 or later.");
return;
}
await Word.run(async (context) => {
const paragraph: Word.Paragraph = context.document.body.insertParagraph(
"Beveled text",
Word.InsertLocation.start,
);
paragraph.font.size = 48;
paragraph.font.bold = true;
const threeDimensionalFormat: Word.ThreeDimensionalFormat = paragraph.font.threeDimensionalFormat;
threeDimensionalFormat.isVisible = true;
threeDimensionalFormat.bevelTopType = Word.BevelType.circle;
threeDimensionalFormat.bevelTopDepth = 6;
threeDimensionalFormat.bevelTopInset = 6;
threeDimensionalFormat.load("bevelTopType,bevelTopDepth,bevelTopInset");
await context.sync();
console.log("Applied bevel formatting:", {
type: threeDimensionalFormat.bevelTopType,
depth: threeDimensionalFormat.bevelTopDepth,
inset: threeDimensionalFormat.bevelTopInset,
});
});
underline
フォントの下線の種類を指定します。
none フォントに下線が付いていない場合。
underline: Word.UnderlineType | "Mixed" | "None" | "Hidden" | "DotLine" | "Single" | "Word" | "Double" | "Thick" | "Dotted" | "DottedHeavy" | "DashLine" | "DashLineHeavy" | "DashLineLong" | "DashLineLongHeavy" | "DotDashLine" | "DotDashLineHeavy" | "TwoDotDashLine" | "TwoDotDashLineHeavy" | "Wave" | "WaveHeavy" | "WaveDouble";
プロパティ値
Word.UnderlineType | "Mixed" | "None" | "Hidden" | "DotLine" | "Single" | "Word" | "Double" | "Thick" | "Dotted" | "DottedHeavy" | "DashLine" | "DashLineHeavy" | "DashLineLong" | "DashLineLongHeavy" | "DotDashLine" | "DotDashLineHeavy" | "TwoDotDashLine" | "TwoDotDashLineHeavy" | "Wave" | "WaveHeavy" | "WaveDouble"
注釈
例
// Underline format text
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a range proxy object for the current selection.
const selection = context.document.getSelection();
// Queue a command to underline the current selection.
selection.font.underline = Word.UnderlineType.single;
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('The selection now has an underline style.');
});
underlineColor
Font オブジェクトの下線の色を指定します。 値は '#RRGGBB' 形式で指定できます。
underlineColor: string;
プロパティ値
string
注釈
メソッドの詳細
decreaseFontSize()
increaseFontSize()
選択されている文字列のフォント サイズを、現在のプリンターで使用可能な次の大きさまで拡大します。
increaseFontSize(): void;
返品
void
注釈
load(options)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(options?: Word.Interfaces.FontLoadOptions): Word.Font;
パラメーター
- options
- Word.Interfaces.FontLoadOptions
読み込むオブジェクトのプロパティのオプションを指定します。
返品
load(propertyNames)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNames?: string | string[]): Word.Font;
パラメーター
- propertyNames
-
string | string[]
読み込むプロパティを指定するコンマ区切りの文字列または文字列の配列。
返品
load(propertyNamesAndPaths)
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Word.Font;
パラメーター
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列であり、 propertyNamesAndPaths.expand は読み込むナビゲーションのプロパティを指定するコンマ区切りの文字列です。
返品
reset()
set(properties, options)
オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクト、または同じ型の別の API オブジェクトを渡すことができます。
set(properties: Interfaces.FontUpdateData, options?: OfficeExtension.UpdateOptions): void;
パラメーター
- properties
- Word.Interfaces.FontUpdateData
メソッドが呼び出されたオブジェクトのプロパティと同型構造のプロパティを持つ JavaScript オブジェクト。
- options
- OfficeExtension.UpdateOptions
プロパティ オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。
返品
void
set(properties)
既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。
set(properties: Word.Font): void;
パラメーター
- properties
- Word.Font
返品
void
setAsTemplateDefault()
指定されたフォント書式を、作業中の文書および現在使用しているテンプレートを使って作成する新規文書の既定のフォント書式として設定します。
setAsTemplateDefault(): void;
返品
void
注釈
toJSON()
API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Word.Font オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Word.Interfaces.FontData と型指定) を返します。
toJSON(): Word.Interfaces.FontData;
返品
track()
ドキュメントの環境変更に基づいて自動的に調整する目的でオブジェクトを追跡します。 この呼び出しは、 context.trackedObjects.add(thisObject) の短縮形です。 このオブジェクトを .sync 呼び出しと ".run" バッチの連続実行の外部で使用していて、プロパティを設定したり、オブジェクトでメソッドを呼び出したりするときに "InvalidObjectPath" エラーが発生する場合は、オブジェクトが最初に作成されたときに、追跡対象のオブジェクト コレクションにオブジェクトを追加する必要があります。 このオブジェクトがコレクションの一部である場合は、親コレクションも追跡する必要があります。
track(): Word.Font;
返品
untrack()
前に追跡されていた場合、このオブジェクトに関連付けられているメモリを解放します。 この呼び出しは、 context.trackedObjects.remove(thisObject) の省略形です。 追跡対象オブジェクトが多いとホスト アプリケーションの動作が遅くなります。追加したオブジェクトが不要になったら、必ずそれを解放してください。 メモリ リリースを有効にする前に、 context.sync() を呼び出す必要があります。
untrack(): Word.Font;