よくわかんないけど以下の手順で解決。
1.一回エラーになってるところを削除してビルド
2.ビルドが通ったらソースを戻すとあら不思議エラーが消えちゃう
なおModelの定義は、最初のPageタグ内の属性で定義する。
xmlns:Model="using:Namespage"
xmlns:Model="using:Namespage"
////// 行列番号をExcelのアドレス文字列に変換 /// /// 行番号 /// 列番号 ///public static string ConvertExcelAddressString(int row, int col) { Dictionary DicInt2Alphabet = new Dictionary () { { 1, "A" }, { 2, "B" }, { 3, "C" }, { 4, "D" }, { 5, "E" }, { 6, "F" }, { 7, "G" }, { 8, "H" }, { 9, "I" }, { 10, "J" }, { 11, "K" }, { 12, "L" }, { 13, "M" }, { 14, "N" }, { 15, "O" }, { 16, "P" }, { 17, "Q" }, { 18, "R" }, { 19, "S" }, { 20, "T" }, { 21, "U" }, { 22, "V" }, { 23, "W" }, { 24, "X" }, { 25, "Y" }, { 26, "Z" }, }; string address = ""; int colTmp = col; //列番号がアルファベットの数よりも大きい場合(変換後AA以上となる場合) 2桁目の文字列を先に算出 if(colTmp > DicInt2Alphabet.Count) { address = DicInt2Alphabet[col / DicInt2Alphabet.Count]; colTmp = colTmp % DicInt2Alphabet.Count; } //行列番号を変換 address += DicInt2Alphabet[colTmp] + row.ToString(); return address; }
string startDate = this.param.startDate.toString();
var query =
from ticket in _context.Tickets
where ticket.StartDate.CompareTo(startDate) >= 0
select ticket;
public HttpResponseMessage Get([FromUri] SagyouNumKousuParamModelGet modelParam)
{
//レスポンスインスタンス生成
HttpResponseMessage response = this.Request.CreateResponse(HttpStatusCode.OK);
using (ExcelPackage inputFile = new ExcelPackage(new System.IO.FileInfo(HttpContext.Current.Server.MapPath("./") + "assets\\Template.xlsx"), false))
{
//inputFileに対して色々と処理
//Content作成
response.Content = new ByteArrayContent(inputFile.GetAsByteArray());
//Contentヘッダ設定
response.Content.Headers.Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.Content.Headers.Add("content-disposition", "attachment; filename=Sample.xlsx");
}
}