Edit

Word.LineWidth enum

Specifies the width of an object's border.

Remarks

API set: WordApiDesktop 1.3

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/add-border-to-paragraph.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) => {
  // Insert a paragraph at the beginning of the document.
  const paragraph: Word.Paragraph =
    context.document.body.insertParagraph(
      "Note: Added a border to this paragraph.",
      Word.InsertLocation.start
    );

  // Load the paragraph borders so they can be formatted.
  const borders: Word.BorderUniversalCollection = paragraph.borders;
  borders.load("items");
  await context.sync();

  // Apply a visible double blue line to every side of the paragraph.
  borders.items.forEach((border: Word.BorderUniversal) => {
    border.isVisible = true;
    border.color = "#4472C4";
    border.lineStyle = Word.BorderLineStyle.double;
    border.lineWidth = Word.LineWidth.pt150;
  });

  await context.sync();

  console.log(
    `Applied the ${Word.BorderLineStyle.double} line style to ${borders.items.length} paragraph borders.`
  );
});

Fields

pt025 = "Pt025"

Represents a line width of 0.25 points.

pt050 = "Pt050"

Represents a line width of 0.50 points.

pt075 = "Pt075"

Represents a line width of 0.75 points.

pt100 = "Pt100"

Represents a line width of 1.00 points.

pt150 = "Pt150"

Represents a line width of 1.50 points.

pt225 = "Pt225"

Represents a line width of 2.25 points.

pt300 = "Pt300"

Represents a line width of 3.00 points.

pt450 = "Pt450"

Represents a line width of 4.50 points.

pt600 = "Pt600"

Represents a line width of 6.00 points.