Back to Devexpress

IdxRichEditTableBorder Interface

vcl-dxrichedit-dot-nativeapi-ab1d6090.md

latest6.7 KB
Original Source

IdxRichEditTableBorder Interface

Exposes table border appearance settings.

Declaration

delphi
IdxRichEditTableBorder = interface(IInterface)

Remarks

The Rich Edit control and the Document Server component allow you to configure all internal and external table borders and individual cell borders. The IdxRichEditTableBorder interface exposes the appearance settings of internal and external table borders.

Main API Members

The list below outlines key members of the IdxRichEditTableBorder interface. You can use these members to configure table appearance settings.

LineColorAllows you to change the table border’s line color.LineStyleAllows you to change the table border’s line pattern or hide the table border.LineThicknessAllows you to adjust the table border’s line thickness.

Code Example: Insert and Configure a Table

The following code example creates a table populated with three columns and rows at the current caret position and customizes the table’s borders and background:

delphi
uses
  dxCoreGraphics; // Declares TdxAlphaColor and TdxAlphaColors types
// ...
var
  ADocument: IdxRichEditDocument;
  ATable: IdxRichEditTable;
  I, J: Integer;
begin
  ADocument := dxRichEditControl1.Document;
  ADocument.BeginUpdate; // Initiates the following batch change
  try
    ATable := ADocument.Tables.Add(ADocument.CaretPosition, 3, 3);
    for I := 0 to ATable.Rows.Count - 1 do
      for J := 0 to ATable.Rows.Self[I].Cells.Count - 1 do
        ADocument.InsertText(ATable.Cell(I, J).Range.Start, 'Lorem ipsum dolor sit amet');
    ATable.Borders.InsideHorizontalBorder.LineStyle := TdxRichEditTableBorderLineStyle.DotDotDash;
    ATable.Borders.InsideHorizontalBorder.LineColor := TdxAlphaColors.Firebrick;
    ATable.Borders.InsideVerticalBorder.LineStyle := TdxRichEditTableBorderLineStyle.Dotted;
    ATable.Borders.Bottom.LineStyle := TdxRichEditTableBorderLineStyle.ThinThickMediumGap;
    ATable.Borders.Bottom.LineThickness := 1.5;
    ATable.Borders.Bottom.LineColor := TdxAlphaColors.Red;
    ATable.Borders.Left.LineStyle := TdxRichEditTableBorderLineStyle.ThinThickMediumGap;
    ATable.Borders.Left.LineColor := TdxAlphaColors.Red;
    ATable.Borders.Left.LineThickness := 1.5;
    ATable.Borders.Right.LineStyle := TdxRichEditTableBorderLineStyle.ThinThickMediumGap;
    ATable.Borders.Right.LineColor := TdxAlphaColors.Red;
    ATable.Borders.Right.LineThickness := 1.5;
    ATable.Borders.Top.LineStyle := TdxRichEditTableBorderLineStyle.ThinThickMediumGap;
    ATable.Borders.Top.LineColor := TdxAlphaColors.Red;
    ATable.Borders.Top.LineThickness := 1.5;
    ATable.TableBackgroundColor := TdxAlphaColors.LightSalmon;
  finally
    ADocument.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
  end;
end;
cpp
#include "dxCoreGraphics.hpp" // Declares TdxAlphaColor and TdxAlphaColors types
// ...
  _di_IdxRichEditDocument ADocument;
  _di_IdxRichEditTable ATable;
  // ...
  ADocument = dxRichEditControl1->Document;
  ADocument->BeginUpdate(); // Initiates the following batch change
  try
  {
    ATable = ADocument->Tables->Add(ADocument->CaretPosition, 3, 3);
    for(int i = 0; i < ATable->Rows->Count; i++)
      for(int j = 0; j < ATable->Rows->Self[i]->Cells->Count; j++)
        ADocument->InsertText(ATable->Cell(i, j)->Range->Start, "Lorem ipsum dolor sit amet");
    ATable->Borders->InsideHorizontalBorder->LineStyle = TdxRichEditTableBorderLineStyle::DotDotDash;
    ATable->Borders->InsideHorizontalBorder->LineColor = TdxAlphaColors::Firebrick;
    ATable->Borders->InsideVerticalBorder->LineStyle = TdxRichEditTableBorderLineStyle::Dotted;
    ATable->Borders->Bottom->LineStyle = TdxRichEditTableBorderLineStyle::ThinThickMediumGap;
    ATable->Borders->Bottom->LineThickness = 1.5f;
    ATable->Borders->Bottom->LineColor = TdxAlphaColors::Red;
    ATable->Borders->Left->LineStyle = TdxRichEditTableBorderLineStyle::ThinThickMediumGap;
    ATable->Borders->Left->LineColor = TdxAlphaColors::Red;
    ATable->Borders->Left->LineThickness = 1.5f;
    ATable->Borders->Right->LineStyle = TdxRichEditTableBorderLineStyle::ThinThickMediumGap;
    ATable->Borders->Right->LineColor = TdxAlphaColors::Red;
    ATable->Borders->Right->LineThickness = 1.5f;
    ATable->Borders->Top->LineStyle = TdxRichEditTableBorderLineStyle::ThinThickMediumGap;
    ATable->Borders->Top->LineColor = TdxAlphaColors::Red;
    ATable->Borders->Top->LineThickness = 1.5f;
    ATable->TableBackgroundColor = TdxAlphaColors::LightSalmon;
  }
  __finally
  {
    ADocument->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
  }

Direct IdxRichEditTableBorder Interface References

The following public API members reference the IdxRichEditTableBorder interface:

IdxRichEditTableBorders.BottomProvides access to the appearance settings of the external bottom table border.IdxRichEditTableBorders.InsideHorizontalBorderProvides access to the appearance settings of all internal horizontal table borders.IdxRichEditTableBorders.InsideVerticalBorderProvides access to the appearance settings of all internal vertical table borders.IdxRichEditTableBorders.LeftProvides access to the appearance settings of the external left table border.IdxRichEditTableBorders.RightProvides access to the appearance settings of the external right table border.IdxRichEditTableBorders.TopProvides access to the appearance settings of the external top table border.

Inheritance

IInterface IdxRichEditTableBorder

See Also

IdxRichEditTableCellBorder Interface

IdxRichEditTableBorder Members

dxRichEdit.NativeApi Unit