forked from dk96/QuotationMaker
fix mac height
parent
5f49b51dd1
commit
e64e1727b5
|
|
@ -518,6 +518,14 @@ namespace QuotationMaker.Controllers
|
|||
saRowIndex--;
|
||||
}
|
||||
|
||||
string agent = Request.Headers["User-Agent"].ToString();
|
||||
|
||||
string post_pc = "win";
|
||||
|
||||
if (agent.Contains("Macintosh"))
|
||||
{
|
||||
post_pc = "mac";
|
||||
}
|
||||
|
||||
//自适应高度,9代表从第10行开始,表头部分不会多行;endRow是结束的行,也就是有数据内容的行数,毕竟没内容的单元格,也没必要自适应行高
|
||||
for (int i = saRowIndex; i < saRowIndex + 3; i++)
|
||||
|
|
@ -543,7 +551,7 @@ namespace QuotationMaker.Controllers
|
|||
cellWidth += sheet.GetColumnWidth(k);
|
||||
}
|
||||
|
||||
int cellStringLength = GetCellStringLength(CurCell.StringCellValue);
|
||||
int cellStringLength = GetCellStringLength(CurCell.StringCellValue, post_pc);
|
||||
|
||||
if (cellStringLength > cellWidth) {
|
||||
double newHg1 = (double)(OldHg * (cellStringLength / cellWidth + 1));
|
||||
|
|
@ -624,7 +632,7 @@ namespace QuotationMaker.Controllers
|
|||
|
||||
string downloadName = objDetail.quotation_name + " 報價單_" + DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
string agent = Request.Headers["User-Agent"].ToString();
|
||||
|
||||
|
||||
//if (agent.Contains("Macintosh"))
|
||||
//{
|
||||
|
|
@ -647,7 +655,7 @@ namespace QuotationMaker.Controllers
|
|||
/// </summary>
|
||||
/// <param name="text">待判断字符或字符串</param>
|
||||
/// <returns>宽度</returns>
|
||||
public int GetCellStringLength(string text)
|
||||
public int GetCellStringLength(string text, string pc_type)
|
||||
{
|
||||
//汉字 453、数字和字母 239
|
||||
//这里的汉字与字母的宽度值,要根据Excel的字体大小计算
|
||||
|
|
@ -662,13 +670,28 @@ namespace QuotationMaker.Controllers
|
|||
continue;
|
||||
}
|
||||
else if (t > 127)
|
||||
{
|
||||
|
||||
if (pc_type == "win")
|
||||
{
|
||||
result += 660;
|
||||
}
|
||||
else {
|
||||
result += 760;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pc_type == "win")
|
||||
{
|
||||
result += 370;
|
||||
}
|
||||
else {
|
||||
result += 440;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue