Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / PreviewRowInfo Class / HorizontalAlign Property
Example


In This Topic
    HorizontalAlign Property (PreviewRowInfo)
    In This Topic
    Gets or sets the horizontal alignment of the preview row information.
    Syntax
    'Declaration
     
    Public Property HorizontalAlign As HorizontalAlign
    'Usage
     
    Dim instance As PreviewRowInfo
    Dim value As HorizontalAlign
     
    instance.HorizontalAlign = value
     
    value = instance.HorizontalAlign
    public HorizontalAlign HorizontalAlign {get; set;}

    Property Value

    HorizontalAlign setting that specifies the horizontal alignment
    Example
    This example customizes the appearance of the preview row.
    // Add this style definition inside the STYLE element in the Default.aspx page.
    .previewer  
     {  
           border-style:dashed;
         border-color:Green;
         border-width:thick;
         font-family:Arial;
         font-style:italic;
         color:Blue;
         background-color:Yellow;
         text-align:right;
         text-decoration:'underline'|'overline'|'line-through'|'blink';
         vertical-align:bottom;
     } 
    
    
    // Define the background.
    FarPoint.Web.Spread.Background bg = new FarPoint.Web.Spread.Background();
    bg.SelectedBackgroundImageUrl = "picture/Winter.jpg";
    bg.BackgroundImageUrl = "picture/Image.bmp";
    FarPoint.Web.Spread.Border bd1 = new FarPoint.Web.Spread.Border();
    bd1.BorderColor = System.Drawing.Color.Blue;
    bd1.BorderStyle = System.Web.UI.WebControls.BorderStyle.Dashed;
    
    // Set the preview row properties.
    FarPoint.Web.Spread.PreviewRowInfo previewRowInfo = new FarPoint.Web.Spread.PreviewRowInfo();
    previewRowInfo.BackColor = Color.Blue;
    previewRowInfo.Background = bg;
    previewRowInfo.Border = bd1;
    previewRowInfo.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
    previewRowInfo.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Middle; 
    previewRowInfo.TabStop = true;
    previewRowInfo.Margin.Bottom = 10;
    previewRowInfo.Margin.Left = 10;
    previewRowInfo.Margin.Right = 10;
    previewRowInfo.Margin.Top = 10;
    previewRowInfo.ForeColor = System.Drawing.Color.Green;
    previewRowInfo.CssClass = "previewer";    // If set to previewer, other setting have no effect.
    previewRowInfo.Font.Bold = true;
    previewRowInfo.Font.Italic = true;
    previewRowInfo.Font.Overline = true;
    previewRowInfo.Font.Size = 20;
    previewRowInfo.Font.Underline = true;
    previewRowInfo.Font.Strikeout = true;
    previewRowInfo.Font.Name = "Verdana";   // Try with some other name of font.
    ListBox1.Items.Add(previewRowInfo.IsEmpty.ToString());
    ListBox1.Items.Add(previewRowInfo.CanSerializeXml.ToString());
    
    // Use the preview row.
    FpSpread1.ActiveSheetView.PreviewRowColumnIndex = 0;
    FpSpread1.ActiveSheetView.PreviewRowStyle = previewRowInfo;
    FpSpread1.ActiveSheetView.PreviewRowVisible = true;
    
    ' Add this style definition inside the STYLE element in the Default.aspx page.
    .previewer  
     {  
           border-style:dashed;
         border-color:Green;
         border-width:thick;
         font-family:Arial;
         font-style:italic;
         color:Blue;
         background-color:Yellow;
         text-align:right;
         text-decoration:'underline'|'overline'|'line-through'|'blink';
         vertical-align:bottom;
     } 
    
    
    ' Define the background.
    Dim bg As New FarPoint.Web.Spread.Background()
    bg.SelectedBackgroundImageUrl = "picture/Winter.jpg"
    bg.BackgroundImageUrl = "picture/Image.bmp"
    Dim bd1 As New FarPoint.Web.Spread.Border()
    bd1.BorderColor = System.Drawing.Color.Blue
    bd1.BorderStyle = System.Web.UI.WebControls.BorderStyle.Dashed
    
    ' Set the preview row properties.
    Dim previewRowInfo As New FarPoint.Web.Spread.PreviewRowInfo()
    previewRowInfo.BackColor = Color.Blue
    previewRowInfo.Background = bg
    previewRowInfo.Border = bd1
    previewRowInfo.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center
    previewRowInfo.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Middle
    previewRowInfo.TabStop = True
    previewRowInfo.Margin.Bottom = 10
    previewRowInfo.Margin.Left = 10
    previewRowInfo.Margin.Right = 10
    previewRowInfo.Margin.Top = 10
    previewRowInfo.ForeColor = System.Drawing.Color.Green
    previewRowInfo.CssClass = "previewer"  ' If set to previewer, other setting have no effect.
    previewRowInfo.Font.Bold = True
    previewRowInfo.Font.Italic = True
    previewRowInfo.Font.Overline = True
    previewRowInfo.Font.Size = 20
    previewRowInfo.Font.Underline = True
    previewRowInfo.Font.Strikeout = True
    previewRowInfo.Font.Name = "Verdana"  ' Try with some other name of font.
    ListBox1.Items.Add(previewRowInfo.IsEmpty.ToString())
    ListBox1.Items.Add(previewRowInfo.CanSerializeXml.ToString())
    
    ' Use the preview row.
    FpSpread1.ActiveSheetView.PreviewRowColumnIndex = 0
    FpSpread1.ActiveSheetView.PreviewRowStyle = previewRowInfo
    FpSpread1.ActiveSheetView.PreviewRowVisible = True
    
    See Also