Sagar Bandkar

Sagar Bandkar

  • 1.4k
  • 347
  • 48.9k

Open pdf,wordpad in browser window with dynamic data

Jan 21 2017 2:15 AM
Controller
[HttpPost]
public JsonResult GeneratePreview(GenerateDemo Demo)
{
string empCode = "", empName = "", email = "", subject = "", body, signature = "";
var formatbody = "";
foreach (var selectedEmpId in GenerateDemo.selectedIds)
{
var empDetails = (from emp in db.demo
where emp.inEmpId == selectedEmpId
select emp).FirstOrDefault();
empCode = empDetails.inEmpCode;
empName = empDetails.vcEmpName;
email = empDetails.vcEmpEmailID;
subject = GenerateDemo.subject;
body = GenerateDemo.body;
signature = GenerateDemo.signature;
formatbody = Constants.createEmailBody(empName, subject, body, signature);<-------- I got all data with Html Format i attach html file
}
return Json(formatbody, JsonRequestBehavior.AllowGet);
}
Html File
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td>
<div style="border-top:3px solid #22BCE5"> </div>
<span style="font-family:Arial;font-size:10pt">
Hello <b>{UserName}</b>,<br /><br />
Subject:-<g>{Subject}</g><br /><br />
{message}
<br /><br />
Thanks<br /><br />
Siganture <br />
{Siganture}
</span>
</td>
</tr>
</table>
</body>
</html>

Answers (1)