Actual syntax should be like below. But both of these syntax doesn't works sometime
font.Boldweight = FontBoldWeight.Bold ;
font.Boldweight = (short)FontBoldWeight.Bold;
FontBoldWeight is type enum, which after type casting may not work sometime. As a workaround if you type caste or use actual short value of enum directly, it works. Below is the declaration of FontBoldWeight. it will make things clear.
**public enum FontBoldWeight
None = 0,
Normal = 400,
Bold = 700,
Seems that the Ernie Banzon answer no longer works exactly as described, possibly due to a namespace change (or in fact that I'm using the HSSF namespace?)
// usings
using NPOI.HSSF.UserModel;
// IWorkbook doc
IFont font = doc.CreateFont();
font.FontHeightInPoints = 11;
font.FontName = "Arial";
font.Boldweight = (short)FontBoldWeight.BOLD;
var font = reportWorkbook.CreateFont();
font.FontHeightInPoints = 11;
font.FontName = "Calibri";
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD;
var cell = headerRow.CreateCell(0);
cell.SetCellValue("Test Bold");
cell.CellStyle = reportWorkbook.CreateCellStyle();
cell.CellStyle.SetFont(font);
matching and replacing text in a string while keeping non replaced text
Reading images from excel (with row and cell position) using excel introp or npoi
How to make a text in the textbox both bold and italic?
C# Create Grid For Painting Pixels and Rendering Text
Brake lines and bold text using string format in C#
Create Text file on OneDrive to set and get data
NPOI: Create a cell containing two differently sized strings
create multiple text file and write to it
search for text in a cell of dataGridView and highlight the row?
Create image on the fly with Text and images in asp.net
How to center align and set bold a text in itext7
How to underline and bold button text through script (Unity3d)
Create number for random and non repeat
Issue in create and write in a text file using c#
DataGridViews, DataBinding and non validating cell values
How to disable create a non English text variables in Visual Studio
RegEx to replace pattern in text file containing carriage returns (using Notepad2 and C#)
Import and Parse a text file containing PCL: ASP.NET C# technique suggestion?
Problem using Regex.Replace when text containing $ and using \b boundry
StreamWriter doesn't create a text file
multithread read and process large text files
Search and Replace text in file .net 2.0.What Am I missing?
How to disable the page and display a In process text Or a Loading in Asp.net website
how to make a label go bold when a mouse go over it and back to normal afterwards
How do i create a database and access it for my windows mobile 5 app?
Can I create an automatic property (no private member) with get and set code?
ASP.NET Core: Create and Open PDF (in browser)
Create Database and Tables with NHibernate and FluentNHibernate?
C# regex to match words containing known substrings and not equal to specific keywords
What's the best way to create a line that starts at a point on another line and extends at a given angle for a given length?
More Query from same tag
Parsing json string that sometimes is an array
How CompareTo method logic works in List sort function?
Restrict Access in WCF using FormsAuthenticationTicket, or other method?
How to find a specific value of a JSON property which is in a directory?
Current selected value in DataGridView using C#
@HTML.DisplayFor is displaying unwanted markup
How to disable zoom in chart control in C#?
How to correctly use GetFolderAsync()?
How to toggle in unity c#?
ASP.NET Core MVC: asp-for is rendering incomplete id and name attributes
Display and grab the value listed in the DropDownList
Make last children as first children using c# windows store app
Registering DynaCaches with SimpleInjector
One of the Form post fields returns NULL .NET Core MVC
How to use sp_helptext in Linqpad
How to move cursor in windows form application?
Pass parameter value to SqlDataSource ASP.NET User.Identity.Name
List counts 1 row data by using foreach
Why is running async operations in threads much slower than pure tasks or pure thread operations
Design Patterns - Linking an Enum to an instance of a class
Correct finishing of server's thread
2D AABB Collision Resolution Multiple Corner Case Issues C#
Difficulty in removing zero values in decimal numbers?
EF Core Migrations: Remove Migrations and Re-Sync Database
Proper Queue threading technique in c#?
Use Response from Webservice to create xaml list
Outputting line numbers
insert into error, using access db in c#
Unity3D: How to control spawner, doesn't stop instantiating when waiting for wave to finish
Sorting with SortableBindingList and DataGridView [C#]