←Select platform

SetCellValue(bool) Method

Summary

Assigns a boolean value to a specific cell within a sheet.

Syntax

C#
C++/CLI
Python
public void SetCellValue( 
   bool value 
) 
public:  
   void SetCellValue( 
      bool value 
   ) 
def SetCellValue(self,value): 

Parameters

value

The boolean value to be set in the cell.

Remarks

The SetCellValue method is tailored for boolean values to allow users to directly set a cell's content to either true or false.

Example

C#
using Leadtools; 
using Leadtools.Document.LEADOffice.Sheet; 
 
 
public void CreateWorkbookFileExample() 
{ 
   // Initialize the workbook 
   var workbook = LEADWorkbookFactory.Create(); 
 
   // Add a new sheet named "Test" 
   var sheet = workbook.CreateSheet("Test"); 
 
   // Access the first cell (assuming 0-based indexing) 
   var cell = sheet.CreateRow(0).CreateCell(0); 
 
   // Update the cell's value 
   cell.SetCellValue("LEADTOOLS"); 
 
   // Style the cell 
   var cellStyle = workbook.CreateCellStyle(); 
   cellStyle.Font = workbook.CreateFont("Arial", 12, FontStyle.Bold, RasterColor.FromKnownColor(RasterKnownColor.Black)); 
   cellStyle.BackgroundColor = RasterColor.FromKnownColor(RasterKnownColor.Gray); 
   cellStyle.HorizontalAlignment = HorizontalAlignment.Center; 
   cellStyle.VerticalAlignment = VerticalAlignment.Center; 
   cellStyle.WrapText = TextWrap.Wrap; 
 
   // Apply the style to the cell 
   cell.SetStyle(cellStyle); 
 
   // Save the workbook to disk 
   var filePath = Path.Combine(LEAD_VARS.ImagesDir, @"WorkbookTest.xlsx"); 
   workbook.Save(filePath); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

Cell Class

Cell Members

Leadtools.Document.LEADOffice.Sheet Namespace

Help Version 23.0.2024.4.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.LEADOffice Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.