Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example has multiple lines of text in the A1 cell.

When the user chooses the "Compress Text" button, the cell width and height are returned to their default values, the text is no longer displayed on multiple lines, and an ellipsis (...) is displayed to indicate more text as shown in the following figure.

C++

void CTypeEllipsesDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
    CDialog::OnShowWindow(bShow, nStatus);

    m_Spread.SetCol(1);
    m_Spread.SetRow(1);
    m_Spread.SetCellType(CellTypeEdit);
    m_Spread.SetTypeEditMultiLine(TRUE);
    m_Spread.SetTypeMaxEditLen(200);
    m_Spread.SetColWidth(1, 15);
    m_Spread.SetRowHeight(1, 25);
    m_Spread.SetText(1,1,CComVariant(_T("This text is longer than the column width")));
    m_Command1.SetWindowText("Compress Text");
    m_Spread.SetEditModePermanent(TRUE);
}

void CTypeEllipsesDlg::OnButton1()
{
    m_Spread.SetColWidth(1, -1);
    m_Spread.SetRowHeight(1, -1);
    m_Spread.SetCol(1);
    m_Spread.SetRow(1);
    m_Spread.SetTypeEllipses(TRUE);
    m_Spread.SetTypeEditMultiLine(FALSE);
}

Visual Basic

Sub Form_Load()
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.CellType = CellTypeEdit
    fpSpread1.TypeEditMultiLine = TRUE
    fpSpread1.TypeMaxEditLen = 200
    fpSpread1.ColWidth(1) = 15
    fpSpread1.RowHeight(1) = 25
    fpSpread1.Text = "This text is longer than the column     width and is originally displayed on multiple     lines."
    Command1.Caption = "Compress Text"
    fpSpread1.EditModePermanent = True
End Sub

Sub Command1_Click()
    fpSpread1.ColWidth(1) = -1
    fpSpread1.RowHeight(1) = -1
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.TypeEllipses = True
    fpSpread1.TypeEditMultiLine = False
End Sub

Copyright © GrapeCity, inc. All rights reserved.