We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Thin and Thik Border

Hello!

why is the border in excel (see picture) so thick and within my programm thin?

first i set no border for the whole grid and after this, i set only thinborders for spezial areas. any idea?

thanks boris

images25.zip

6 Replies

AD Administrator Syncfusion Team February 27, 2007 10:54 PM UTC

Hi Boris,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Here is a sample.
GDBGExportRowHeader.zip

Best regards,
Haneef


AD Administrator Syncfusion Team March 16, 2007 09:28 AM UTC

hello!

please look at thread:

http://www.syncfusion.com/support/Forums/message.aspx?MessageID=52502

there is an example.

Regards,
Boris


AD Administrator Syncfusion Team March 16, 2007 05:08 PM UTC

Hi Boris,

The reason for getting this behavior is that you are setting the GridBorderStyle to Solid in a cell. By default the GridExcelConverterControl does not care about the GridBorderWeight parameter while exporting the grid data to excel. Please find the code snippet from GridExcelConverterBase.cs file that convert the GridBorderStyle to ExcelLineStyle in a GridExcelConverterControlBase.

//Default code for converting GridBorderStyle into ExcelLineStyle.
[C#]
private ExcelLineStyle GetExcelLineStyle(GridBorderStyle gridLineStyle)
{
switch (gridLineStyle)
{
case GridBorderStyle.DashDot: return ExcelLineStyle.Dash_dot;
case GridBorderStyle.DashDotDot: return ExcelLineStyle.Dash_dot_dot;
case GridBorderStyle.Dashed: return ExcelLineStyle.Dashed;
case GridBorderStyle.Dotted: return ExcelLineStyle.Dotted;
case GridBorderStyle.None: return ExcelLineStyle.None;
case GridBorderStyle.NotSet: return ExcelLineStyle.None;
case GridBorderStyle.Solid: return ExcelLineStyle.Thick;
case GridBorderStyle.Standard: return ExcelLineStyle.Thin;

default: throw new ArgumentOutOfRangeException("Border style is out of range");
}
}

If you want to change the behavior then you need the modified code snippet in the GetExcelLineStyle method (file: GridExcelConverterBase.cs; Line Number :972 ) of the forum sample. Please let me know if this helps.

Best regards,
Haneef


BJ Boris Jansen March 20, 2007 09:24 AM UTC

Hi,

thank you for the code (perfect!!!!!). It helped, but how can i disable the default gridstyle within excel?

in excel i can set the option --> do not show gridlines. how can i do this within my code?

please have a look at the screenshots.

thank you very much.
boris

nogridlines.zip


AD Administrator Syncfusion Team March 20, 2007 03:07 PM UTC

Hi Boris,

You can control the appearance of the grid line border using the IsGridLinesVisible property of the WorkSheet. If you want to hide the gridLines in a Excel then add the sheet.IsGridLinesVisible = false; statement in a GridToExcel method of the GridExcelConverterControl(150th line of the GridExcelConverterControl.cs file). Here is a modified code of the ExportChart sample.

public void GridToExcel( GridModel grid, string fileName, ConverterOptions options )
{
ExcelEngine engine = CreateEngine();
IWorkbook book = engine.Excel.Workbooks.Create( 1 );
IWorksheet sheet = book.Worksheets[ 0 ];

sheet.IsGridLinesVisible = false; ////Line Number 150..
GridToExcel( grid, sheet, options );

book.Close( true, fileName );
}

Best regards,
Haneef


AD Administrator Syncfusion Team March 21, 2007 06:28 AM UTC

perfect!!!!! thanks very much

>Hi Boris,

You can control the appearance of the grid line border using the IsGridLinesVisible property of the WorkSheet. If you want to hide the gridLines in a Excel then add the sheet.IsGridLinesVisible = false; statement in a GridToExcel method of the GridExcelConverterControl(150th line of the GridExcelConverterControl.cs file). Here is a modified code of the ExportChart sample.

public void GridToExcel( GridModel grid, string fileName, ConverterOptions options )
{
ExcelEngine engine = CreateEngine();
IWorkbook book = engine.Excel.Workbooks.Create( 1 );
IWorksheet sheet = book.Worksheets[ 0 ];

sheet.IsGridLinesVisible = false; ////Line Number 150..
GridToExcel( grid, sheet, options );

book.Close( true, fileName );
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon