-
Notifications
You must be signed in to change notification settings - Fork 1
/
WebForm1.aspx.cs
67 lines (58 loc) · 1.93 KB
/
WebForm1.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Novacode;
using System.Web.Script.Serialization;
using System.Web.Services;
namespace BIDoc
{
public partial class WebForm1 : System.Web.UI.Page
{
public static string OutputFileLocation = "";
public static string OutputFileName = "BIOutputDoc.docx";
protected void Page_Load(object sender, EventArgs e)
{
OutputFileLocation = Request.PhysicalApplicationPath;
}
[WebMethod]
public static string SubmitForm(List<FormData> FormData)
{
string messsage = "Sucess";
try
{
BiDocument biDoc = new BiDocument();
foreach(FormData fd in FormData)
{
Unit u = new Unit();
u.ID = fd.ID;
u.Body = fd.Value;
biDoc.Units.Add(u);
}
using (DocX document = DocX.Create(OutputFileLocation + OutputFileName))
{
foreach (Unit u in biDoc.Units)
{
Paragraph heading = document.InsertParagraph();
heading.Append(u.Body)
.Font(new System.Drawing.FontFamily("Calibri"))
.FontSize(16)
.Color(System.Drawing.Color.Blue);
// .Alignment = Alignment.center;
}
document.Save();
}
}
catch (Exception ex)
{
}
return messsage;
}
protected void Btn_CreateDoc_Click(object sender, EventArgs e)
{
}
}
}