4 Answers, 1 is accepted
0
Hi cesar,
This is the exact way that default height of the rows should be applied and it is working fine on our end. Could you elaborate what you mean when saying that it doesn't work?
Here is the code I am testing with, please try it out and send us some snapshots of the result you are seeing.
Regards,
Petya
Telerik
This is the exact way that default height of the rows should be applied and it is working fine on our end. Could you elaborate what you mean when saying that it doesn't work?
Here is the code I am testing with, please try it out and send us some snapshots of the result you are seeing.
Workbook workbook =
new
Workbook();
Worksheet worksheet = workbook.Sheets.Add(SheetType.Worksheet)
as
Worksheet;
worksheet.Cells[0, 0].SetFontSize(30);
worksheet.Cells[0, 0].SetValue(
"test"
);
worksheet.DefaultRowHeight =
new
RowHeight(UnitHelper.PointToDip(13),
true
);
Regards,
Petya
Telerik
0

cesar
Top achievements
Rank 1
answered on 23 Apr 2015, 02:46 PM
Hi Petya,
Your code works fine but my code still not. I am getting 12.75. Here it is:
_workbook =
new
Workbook();
DocumentTheme theme =
new
DocumentTheme(
"From predefined schemes"
, PredefinedThemeSchemes.ColorSchemes[0], fontScheme);
_workbook.Theme = theme;
CellStyle normalStyle = _workbook.Styles[
"Normal"
];
normalStyle.FontFamily =
new
ThemableFontFamily(
"Verdana"
);
normalStyle.FontSize = UnitHelper.PointToDip(10);
normalStyle.VerticalAlignment = RadVerticalAlignment.Center;
_workbook.Sheets.Add(SheetType.Worksheet);
Worksheet worksheet = _workbook.ActiveWorksheet;
worksheet.DefaultRowHeight =
new
RowHeight(UnitHelper.PointToDip(13),
true
);
worksheet.Rows[0].SetHeight(
new
RowHeight(UnitHelper.PointToDip(46.5),
true
));
ColumnSelection colSelection = worksheet.Columns[0];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 29),
true
));
//A
colSelection = worksheet.Columns[1];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 77),
true
));
//B
colSelection = worksheet.Columns[2];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 5.5),
true
));
//C
colSelection = worksheet.Columns[3];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 15.6),
true
));
//D
colSelection = worksheet.Columns[4];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 11),
true
));
//E
colSelection = worksheet.Columns[5];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 16.3),
true
));
//F
colSelection = worksheet.Columns[6];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 14.8),
true
));
//G
colSelection = worksheet.Columns[7];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 15.6),
true
));
//H
colSelection = worksheet.Columns[8];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 15.6),
true
));
//I
colSelection = worksheet.Columns[9];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 11.8),
true
));
//J
colSelection = worksheet.Columns[10];
colSelection.SetWidth(
new
ColumnWidth(UnitHelper.ExcelColumnWidthToPixelWidth(worksheet.Workbook, 8.5),
true
));
//K
CellBorder border =
new
CellBorder(CellBorderStyle.Medium,
new
ThemableColor(Colors.Black));
//INFO DATA
worksheet.Cells[2, 0, 8, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[9, 0, 15, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[16, 0, 26, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[27, 0, 27, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[28, 0, 35, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[36, 0, 43, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[44, 0, 54, 2].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
//JOB DATA
worksheet.Cells[1, 3, 3, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[17, 3, 17, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[17, 3, 21, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[22, 3, 25, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[26, 3, 29, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[30, 3, 31, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[32, 3, 35, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[36, 3, 57, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
worksheet.Cells[58, 3, 63, 10].SetBorders(
new
CellBorders(border, border, border, border,
null
,
null
,
null
,
null
));
0
Hello cesar,
I'm presuming you are referring to the value shown in MS Excel's Row Height dialog, is that correct?
This behavior is specifically strange and I am not sure why it occurs. I inspected the XML generated for this particular sheet and the default value for the rows is indeed 13. In fact, if you show the same dialog outside the range of cells that has borders, it would again show 13. We also tried measuring the height of the rows with ruler software and they appear to have the same height.
I'm presuming the behavior has something to do with specific MS Excel UI functionality and the borders, but couldn't advise you on how you can unify it.
Regards,
Petya
Telerik
I'm presuming you are referring to the value shown in MS Excel's Row Height dialog, is that correct?
This behavior is specifically strange and I am not sure why it occurs. I inspected the XML generated for this particular sheet and the default value for the rows is indeed 13. In fact, if you show the same dialog outside the range of cells that has borders, it would again show 13. We also tried measuring the height of the rows with ruler software and they appear to have the same height.
I'm presuming the behavior has something to do with specific MS Excel UI functionality and the borders, but couldn't advise you on how you can unify it.
Regards,
Petya
Telerik
0

cesar
Top achievements
Rank 1
answered on 24 Apr 2015, 03:33 PM
Hi Petya,
Thank you for spending time on this. I will leave it as is with 12.75.
0.25 is not a such difference.
Cesar