diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs
index bf304e72..e472033d 100644
--- a/Controllers/ApiController.cs
+++ b/Controllers/ApiController.cs
@@ -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
///
/// 待判断字符或字符串
/// 宽度
- public int GetCellStringLength(string text)
+ public int GetCellStringLength(string text, string pc_type)
{
//汉字 453、数字和字母 239
//这里的汉字与字母的宽度值,要根据Excel的字体大小计算
@@ -663,11 +671,26 @@ namespace QuotationMaker.Controllers
}
else if (t > 127)
{
- result += 660;
+
+ if (pc_type == "win")
+ {
+ result += 660;
+ }
+ else {
+ result += 760;
+ }
+
}
else
{
- result += 370;
+ if (pc_type == "win")
+ {
+ result += 370;
+ }
+ else {
+ result += 440;
+ }
+
}
}
return result;