0
내 웹 응용 프로그램 :이 단추는 웹 서비스 기능을 호출하는 버튼을 클릭합니다.이 함수는 DocX dll을 사용하여 파일을 만듭니다. 이 파일을 방금 웹 브라우저를 통해 웹에서 비슷한 파일을 다운로드하여 만든 파일을 다운로드하고 싶습니다. 어떻게 수행하나요?이 파일이 asp.net에서 생성 된 파일을 다운로드하는 방법
아래에 내 코드 // 버튼 이벤트를 클릭
$(frm_id+' #btn_eprt_tml')
.button()
.click(function(){
//eprt_tml
$.ajax({
type: "POST",
url: "JqueryFunction.aspx/eprt_tml",
data: "{ptcn_id:'"+ptcn_id+"'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("Completed");
},
error: function() {
alert("Not completed");
}
});
// eprt_tml 기능
[System.Web.Services.WebMethod]
public static void eprt_tml(int ptcn_id)
{
DocX g_document;
try
{
// Store a global reference to the loaded document.
g_document = DocX.Load(@"D:\Project\CRM1\tml\tml_tpt.docx");
g_document = crt_from_tpl(DocX.Load(@"D:\Project\CRM1\tml\tml_tpt.docx"));
// Save all changes made to this template as Invoice_The_Happy_Builder.docx (We don't want to replace InvoiceTemplate.docx).
//g_document.Save();
g_document.SaveAs(@"D:\Project\CRM1\tml\Invoice_The_Happy_Builder.docx");
}
// The template 'Template.docx' does not exist, so create it.
catch (FileNotFoundException)
{
}
}
// crt_from_tpl 기능
[System.Web.Services.WebMethod]
private static DocX crt_from_tpl(DocX template)
{
template.AddCustomProperty(new CustomProperty("static_title", "afdaslfjlk"));
template.AddCustomProperty(new CustomProperty("tmlname", "asdfasdfasf"));
template.AddCustomProperty(new CustomProperty("tmlcontent", "asdfasd"));
template.AddCustomProperty(new CustomProperty("ptcnname", "asdasdfsd"));
template.AddCustomProperty(new CustomProperty("ptcntitle", "asdfasdfsad"));
template.AddCustomProperty(new CustomProperty("coursename", "asdfsadsdf"));
return template;
}
당신이 더 많은 것을 설명 할 수 우르 "tml_tpt"를 교체합니다. 나는 처음이다. 감사합니다 – Hainlp