根据我的发现,我可以通过以下方式表示sites
密钥的多个值:how to post multiple value with same key in python requests?
但如何将此多值键与常规键action
和extype
结合使用?我不能再使用普通的dict参数了。
答案 0 :(得分:1)
我不明白为什么你不能使用"常规字典"。相反:
[HttpPost]
public ActionResult excel(Student st)
{
Excel.Application app = new Excel.Application();
Excel.Workbook myworkbook = app.Workbooks.Add(System.Reflection.Missing.Value);
// Excel.Worksheet mysheet = myworkbook.ActiveSheet ;
///////write header in excel
mysheet.Cells[1, 1] = "ID";
mysheet.Cells[1, 2] = "Name";
mysheet.Cells[1, 3] = "Email";
mysheet.Cells[1, 4] = "Age";
mysheet.Cells[1, 5] = "PassWord";
mysheet.Cells[1, 6] = "Confirm";
int row = 2;
//putting received data from create action in excel sheet.
mysheet.Cells[row, 1] = st.ID;
mysheet.Cells[row, 2] = st.Name;
mysheet.Cells[row, 3] = st.E_Mail;
mysheet.Cells[row, 4] = st.Age;
mysheet.Cells[row, 5] = st.PassWord;
mysheet.Cells[row, 6] = st.Confirm;
// save the data
myworkbook.SaveAs("f:\\myfirstexcelmvc.xls");
myworkbook.Close();
Marshal.ReleaseComObject(myworkbook);
app.Quit();
Marshal.FinalReleaseComObject(app);
}