- Регистрация
- 08.10.2023
- Сообщения
- 142
- Благодарностей
- 38
- Баллы
- 28
Hello ZennoPoster Friend
,
I have been working with Excel files within ZennoPoster and have successfully managed to apply styles to cells using C# code, such as adjusting font size and other properties. My current challenge involves setting the width of a column in an Excel table to a specific value directly within ZennoPoster's C# script.
I am aware that in a standard C# environment, one might use a library like ClosedXML to adjust the width of Excel columns with ease. However, I am looking for a way to do this natively within ZennoPoster's framework.
Here's an example of what I've achieved with font styling:
I would like to extend this functionality to also set the column width. Does anyone know if ZennoPoster supports this feature through C# code? If so, could you provide an example or point me towards the relevant documentation?
Because it's looks like this code don't work:
Thank you in advance for your Help!

I have been working with Excel files within ZennoPoster and have successfully managed to apply styles to cells using C# code, such as adjusting font size and other properties. My current challenge involves setting the width of a column in an Excel table to a specific value directly within ZennoPoster's C# script.
I am aware that in a standard C# environment, one might use a library like ClosedXML to adjust the width of Excel columns with ease. However, I am looking for a way to do this natively within ZennoPoster's framework.
Here's an example of what I've achieved with font styling:
C#:
// Get the table by its name in the project
var table = project.Tables["Credentials"];
// Create a new style for formatting
var style = new ZennoTableStyle
{
Font = new Font("Arial", 14, FontStyle.Bold)
};
// Apply the style to the entire first column
for (int row = 0; row < table.RowCount; row++)
{
table.SetCellStyle(0, row, style); // Apply the style to each cell in the first column
}
Because it's looks like this code don't work:
table.SetColumnWidth(0, 30);
Thank you in advance for your Help!