2022年11月15日 星期二

epplus 設定儲存格為行動電話格式

  public static void 設定行動電話(this ExcelRange range, string 電話)
        {
            range.Value = 電話.ToInt64();
            range.Style.Numberformat.Format = "[>99999999]0000-000-000;000-000-000";
        }

 ws.Cells[rowindex, colindex].設定行動電話("0911222333"); => excel 顯示為 0911-222-333

2022年11月1日 星期二

javascript 走訪物件屬性

for (const prop in obj)
    if (Object.prototype.hasOwnProperty.call(obj, prop)) 
        console.log(obj[prop]);

Entity Framework 建立新物件並儲存後馬上取得關聯資料

使用 CreateProxy 建立物件,不要直接 new var newmodel = _contextXXX.CreateProxy<yyy>(); ... _contextXXX.yyy.Add(newmodel); await _contextXXX.SaveC...