duhongyu %!s(int64=4) %!d(string=před) roky
rodič
revize
27aaced279

File diff suppressed because it is too large
+ 14 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs


+ 61 - 35
CallCenterCommon/CallCenter.Utility/word/ExportWord.cs

16
             Object Nothing = System.Reflection.Missing.Value;
16
             Object Nothing = System.Reflection.Missing.Value;
17
             Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
17
             Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
18
               Microsoft.Office.Interop.Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
18
               Microsoft.Office.Interop.Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
19
-              WordApp.Selection.PageSetup.LeftMargin = 50f;
20
-              WordApp.Selection.PageSetup.RightMargin = 50f;
21
-              WordApp.Selection.PageSetup.PageWidth = 650f;  //页面宽度 
19
+        //设置纸张为A4纸大小
20
+        WordDoc.PageSetup.PaperSize = MSWord.WdPaperSize.wdPaperA4;
22
               WordDoc.ActiveWindow.Selection.Font.Bold = 2;
21
               WordDoc.ActiveWindow.Selection.Font.Bold = 2;
23
-             WordApp.Selection.ParagraphFormat.LineSpacing = 13f;//设置文档的行间距      
24
-              //移动焦点并换行 
25
-             object count = 14;
22
+             WordApp.Selection.ParagraphFormat.LineSpacing = 13f;//设置文档的行间距     
23
+        WordDoc.PageSetup.LeftMargin = 45f;
24
+        WordDoc.PageSetup.RightMargin  = 45f;
25
+        //移动焦点并换行 
26
+        object count = 14;
26
               object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;
27
               object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;
27
              WordApp.Selection.ParagraphFormat.LineSpacing = 18f;
28
              WordApp.Selection.ParagraphFormat.LineSpacing = 18f;
28
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
29
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
30
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
31
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
31
               WordApp.Selection.TypeParagraph();//插入段落 
32
               WordApp.Selection.TypeParagraph();//插入段落 
32
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
33
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
34
+              WordApp.Selection.Font.Name = "小四";
33
               WordApp.Selection.Font.Size = 18f;
35
               WordApp.Selection.Font.Size = 18f;
34
               object missing = System.Reflection.Missing.Value;
36
               object missing = System.Reflection.Missing.Value;
35
               object WdLine2 = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;   
37
               object WdLine2 = Microsoft.Office.Interop.Word.WdUnits.wdLine;//换一行;   
39
               WordApp.Selection.MoveDown(ref WdLine, ref count, ref Nothing);//移动焦点 
41
               WordApp.Selection.MoveDown(ref WdLine, ref count, ref Nothing);//移动焦点 
40
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
42
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
41
               WordApp.Selection.TypeParagraph();//插入段落 
43
               WordApp.Selection.TypeParagraph();//插入段落 
42
-              WordApp.Selection.Font.Size = 10.5f;
44
+              WordApp.Selection.Font.Size = 11f;
43
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
45
               WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
44
               WordApp.Selection.Font.Color = Microsoft.Office.Interop.Word.WdColor.wdColorBlack;
46
               WordApp.Selection.Font.Color = Microsoft.Office.Interop.Word.WdColor.wdColorBlack;
45
               //文档中创建表格 
47
               //文档中创建表格 
46
-             Microsoft.Office.Interop.Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, 18, 9, ref Nothing, ref Nothing);
48
+             Microsoft.Office.Interop.Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, 18, 8, ref Nothing, ref Nothing);
47
              //设置表格样式 
49
              //设置表格样式 
48
-            for (int i = 1; i < 10; i ++)
50
+            for (int i = 1; i < 9; i ++)
49
             {
51
             {
50
             if (i ==2)
52
             if (i ==2)
51
             {
53
             {
52
-                newTable.Columns[i].Width = 70f;
54
+                newTable.Columns[i].Width = 75f;
53
             }
55
             }
54
-            else  if (i ==9)
56
+            else  if (i ==8)
55
             {
57
             {
56
                 newTable.Columns[i].Width = 80f;
58
                 newTable.Columns[i].Width = 80f;
57
             }
59
             }
60
+            else if (i ==4)
61
+            {
62
+                newTable.Columns[i].Width = 65f;
63
+            }
64
+            else if (i == 6)
65
+            {
66
+                newTable.Columns[i].Width = 65f;
67
+            }
58
             else  
68
             else  
59
             newTable.Columns[i].Width = 60f;
69
             newTable.Columns[i].Width = 60f;
60
             }
70
             }
61
             for (int i=1;i<19;i++)
71
             for (int i=1;i<19;i++)
62
            {
72
            {
63
-            newTable.Rows[i].Height = 35f;
73
+            newTable.Rows[i].Height = 32f;
64
            }
74
            }
65
         string user = "";
75
         string user = "";
66
           if (jbdata.Rows.Count > 0)
76
           if (jbdata.Rows.Count > 0)
77
              newTable.Cell(1, 1).Range.Text = "事项编号";
87
              newTable.Cell(1, 1).Range.Text = "事项编号";
78
              newTable.Cell(1, 1).Merge(newTable.Cell(2, 1));
88
              newTable.Cell(1, 1).Merge(newTable.Cell(2, 1));
79
              newTable.Cell(1, 2).Range.Text = dt.Rows[0]["F_WorkOrderId"].ToString();
89
              newTable.Cell(1, 2).Range.Text = dt.Rows[0]["F_WorkOrderId"].ToString();
80
-             newTable.Cell(1, 2).Merge(newTable.Cell(2, 3));
90
+        newTable.Cell(1, 2).Range.Font.Bold  = 0;
91
+        newTable.Cell(1, 2).Merge(newTable.Cell(2, 2));
81
              newTable.Cell(1, 3).Range.Text = "工单来源";
92
              newTable.Cell(1, 3).Range.Text = "工单来源";
82
              newTable.Cell(1, 4).Range.Text = dt.Rows[0]["SourceName"].ToString();
93
              newTable.Cell(1, 4).Range.Text = dt.Rows[0]["SourceName"].ToString();
83
-       
84
-             newTable.Cell(1, 5).Range.Text = "办理时限";
94
+        newTable.Cell(1, 4).Range.Font.Bold = 0;
95
+        newTable.Cell(1, 5).Range.Text = "办理时限";
85
         if (jbdata.Rows.Count > 0)
96
         if (jbdata.Rows.Count > 0)
86
         {
97
         {
87
             if (jbdata.Rows[0]["F_LimitTime"]!=null && jbdata.Rows[0]["F_LimitTime"].ToString()!="")
98
             if (jbdata.Rows[0]["F_LimitTime"]!=null && jbdata.Rows[0]["F_LimitTime"].ToString()!="")
92
            
103
            
93
         else
104
         else
94
             newTable.Cell(1, 6).Range.Text = "";
105
             newTable.Cell(1, 6).Range.Text = "";
95
-            newTable.Cell(1, 7).Range.Text = "联系电话";
106
+        newTable.Cell(1, 6).Range.Font.Bold = 0;
107
+        newTable.Cell(1, 7).Range.Text = "联系电话";
96
            newTable.Cell(1, 8).Range.Text = dt.Rows[0]["F_CusPhone"].ToString();
108
            newTable.Cell(1, 8).Range.Text = dt.Rows[0]["F_CusPhone"].ToString();
97
-             newTable.Cell(2, 3).Range.Text = "签收时间";
109
+        newTable.Cell(1, 8).Range.Font.Bold = 0;
110
+        newTable.Cell(2, 3).Range.Text = "签收时间";
98
         if (jbdata.Rows.Count > 0)
111
         if (jbdata.Rows.Count > 0)
99
         {
112
         {
100
             if (jbdata.Rows[0]["F_SureTime"] != null && jbdata.Rows[0]["F_SureTime"].ToString() != "")
113
             if (jbdata.Rows[0]["F_SureTime"] != null && jbdata.Rows[0]["F_SureTime"].ToString() != "")
101
                 newTable.Cell(2, 4).Range.Text = DateTime.Parse(jbdata.Rows[0]["F_SureTime"].ToString()).ToString("yyyy-MM-dd");
114
                 newTable.Cell(2, 4).Range.Text = DateTime.Parse(jbdata.Rows[0]["F_SureTime"].ToString()).ToString("yyyy-MM-dd");
102
             else
115
             else
103
                 newTable.Cell(2, 4).Range.Text = "";
116
                 newTable.Cell(2, 4).Range.Text = "";
117
+            
104
         }
118
         }
105
         else
119
         else
106
             newTable.Cell(2, 4).Range.Text = "";
120
             newTable.Cell(2, 4).Range.Text = "";
107
-           newTable.Cell(2, 5).Range.Text = "办理时间";
121
+        newTable.Cell(2, 4).Range.Font.Bold = 0;
122
+        newTable.Cell(2, 5).Range.Text = "办理时间";
108
         if (dt.Rows[0]["F_CreateTime"] != null && dt.Rows[0]["F_CreateTime"].ToString() != "")
123
         if (dt.Rows[0]["F_CreateTime"] != null && dt.Rows[0]["F_CreateTime"].ToString() != "")
109
             newTable.Cell(2, 6).Range.Text = DateTime.Parse(dt.Rows[0]["F_CreateTime"].ToString()).ToString("yyyy-MM-dd");
124
             newTable.Cell(2, 6).Range.Text = DateTime.Parse(dt.Rows[0]["F_CreateTime"].ToString()).ToString("yyyy-MM-dd");
110
         else  
125
         else  
111
         newTable.Cell(2, 6).Range.Text = dt.Rows[0]["F_CreateTime"].ToString();
126
         newTable.Cell(2, 6).Range.Text = dt.Rows[0]["F_CreateTime"].ToString();
127
+        newTable.Cell(2, 6).Range.Font.Bold = 0;
112
         newTable.Cell(2, 7).Range.Text = "来电人";
128
         newTable.Cell(2, 7).Range.Text = "来电人";
113
         newTable.Cell(2, 8).Range.Text = dt.Rows[0]["F_CusName"].ToString();
129
         newTable.Cell(2, 8).Range.Text = dt.Rows[0]["F_CusName"].ToString();
130
+        newTable.Cell(2,8).Range.Font.Bold = 0;
114
         newTable.Cell(3, 1).Range.Text = "事项区域";
131
         newTable.Cell(3, 1).Range.Text = "事项区域";
115
-            newTable.Cell(3, 2).Range.Text = dt.Rows[0]["F_SourceAddress"].ToString();
116
-        newTable.Cell(3, 2).Merge(newTable.Cell(3, 9));
117
-            newTable.Cell(4, 1).Range.Text = "内容摘要";
132
+        newTable.Cell(3, 2).Range.Text = dt.Rows[0]["F_SourceAddress"].ToString();
133
+        newTable.Cell(3, 2).Merge(newTable.Cell(3, 8));
134
+        newTable.Cell(3, 2).Range.Font.Bold = 0;
135
+        newTable.Cell(4, 1).Range.Text = "内容摘要";
118
             newTable.Cell(4, 1).Merge(newTable.Cell(7, 1));
136
             newTable.Cell(4, 1).Merge(newTable.Cell(7, 1));
119
         if (dt.Rows[0]["F_Content"] != null && dt.Rows[0]["F_Content"].ToString() != "")
137
         if (dt.Rows[0]["F_Content"] != null && dt.Rows[0]["F_Content"].ToString() != "")
120
         {
138
         {
124
         {
142
         {
125
             newTable.Cell(4, 2).Range.Text = dt.Rows[0]["F_ComContent"].ToString();
143
             newTable.Cell(4, 2).Range.Text = dt.Rows[0]["F_ComContent"].ToString();
126
         }
144
         }
127
-        newTable.Cell(4, 2).Merge(newTable.Cell(7, 9));
128
-        newTable.Cell(4, 1).Height = 120f;
129
-        newTable.Cell(4, 2).Height = 120f;
145
+        newTable.Cell(4, 2).Merge(newTable.Cell(7, 8));
146
+        newTable.Cell(4, 2).Range.Font.Bold = 0;
147
+        newTable.Cell(4, 1).Height = 130f;
148
+        newTable.Cell(4, 2).Height = 130f;
130
         newTable.Cell(5, 1).Range.Text = "承办单位";
149
         newTable.Cell(5, 1).Range.Text = "承办单位";
131
         if (jbdata.Rows.Count > 0)
150
         if (jbdata.Rows.Count > 0)
132
             newTable.Cell(5, 2).Range.Text = jbdata.Rows[0]["DeptName"].ToString();
151
             newTable.Cell(5, 2).Range.Text = jbdata.Rows[0]["DeptName"].ToString();
133
         newTable.Cell(5, 2).Merge(newTable.Cell(5, 4));
152
         newTable.Cell(5, 2).Merge(newTable.Cell(5, 4));
134
-           newTable.Cell(5, 3).Range.Text = "协办单位";
153
+        newTable.Cell(5, 2).Range.Font.Bold = 0;
154
+        newTable.Cell(5, 3).Range.Text = "协办单位";
135
         if (jbdata.Rows.Count > 0)
155
         if (jbdata.Rows.Count > 0)
136
             newTable.Cell(5, 4).Range.Text = jbdata.Rows[0]["OtherDeptName"].ToString();
156
             newTable.Cell(5, 4).Range.Text = jbdata.Rows[0]["OtherDeptName"].ToString();
137
-        newTable.Cell(5, 4).Merge(newTable.Cell(5, 7));
157
+        newTable.Cell(5, 4).Merge(newTable.Cell(5, 6));
158
+        newTable.Cell(5, 4).Range.Font.Bold = 0;
138
         newTable.Cell(6, 1).Range.Text = "调度意见";
159
         newTable.Cell(6, 1).Range.Text = "调度意见";
139
         newTable.Cell(6, 1).Merge(newTable.Cell(8, 1));
160
         newTable.Cell(6, 1).Merge(newTable.Cell(8, 1));
140
         if (jbdata.Rows.Count > 0)
161
         if (jbdata.Rows.Count > 0)
141
             newTable.Cell(6, 2).Range.Text = jbdata.Rows[0]["F_AssignedOpinion"].ToString();
162
             newTable.Cell(6, 2).Range.Text = jbdata.Rows[0]["F_AssignedOpinion"].ToString();
142
-        newTable.Cell(6, 2).Merge(newTable.Cell(8, 9));
163
+        newTable.Cell(6, 2).Merge(newTable.Cell(8, 8));
164
+        newTable.Cell(6, 2).Range.Font.Bold = 0;
143
         newTable.Cell(6, 1).Height = 90f;
165
         newTable.Cell(6, 1).Height = 90f;
144
         newTable.Cell(6, 2).Height = 90f;
166
         newTable.Cell(6, 2).Height = 90f;
145
         newTable.Cell(7, 1).Range.Text = "承办意见";
167
         newTable.Cell(7, 1).Range.Text = "承办意见";
146
         newTable.Cell(7, 1).Merge(newTable.Cell(8, 1));
168
         newTable.Cell(7, 1).Merge(newTable.Cell(8, 1));
147
         newTable.Cell(7, 2).Range.Text = "  ";
169
         newTable.Cell(7, 2).Range.Text = "  ";
148
-        newTable.Cell(7, 2).Merge(newTable.Cell(8, 9));
170
+        newTable.Cell(7, 2).Merge(newTable.Cell(8, 8));
171
+        newTable.Cell(7, 1).Height = 50f;
172
+        newTable.Cell(7, 2).Height = 50f;
149
         newTable.Cell(8, 1).Range.Text = "领导批示";
173
         newTable.Cell(8, 1).Range.Text = "领导批示";
150
         newTable.Cell(8, 1).Merge(newTable.Cell(9, 1));
174
         newTable.Cell(8, 1).Merge(newTable.Cell(9, 1));
151
         newTable.Cell(8, 2).Range.Text = "";
175
         newTable.Cell(8, 2).Range.Text = "";
152
-        newTable.Cell(8, 2).Merge(newTable.Cell(9, 9));
176
+        newTable.Cell(8, 2).Merge(newTable.Cell(9, 8));
177
+        newTable.Cell(8, 1).Height = 50f;
178
+        newTable.Cell(8, 2).Height = 50f;
153
         newTable.Cell(9, 1).Range.Text = "处理结果";
179
         newTable.Cell(9, 1).Range.Text = "处理结果";
154
         newTable.Cell(9, 1).Merge(newTable.Cell(12, 1));
180
         newTable.Cell(9, 1).Merge(newTable.Cell(12, 1));
155
         newTable.Cell(9, 2).Range.Text = dt.Rows[0]["F_Result"].ToString();
181
         newTable.Cell(9, 2).Range.Text = dt.Rows[0]["F_Result"].ToString();
156
-        newTable.Cell(9, 2).Merge(newTable.Cell(12, 9));
157
-        newTable.Cell(9, 1).Height = 120f;
158
-        newTable.Cell(9, 2).Height = 120f;
182
+        newTable.Cell(9, 2).Merge(newTable.Cell(12, 8));
183
+        newTable.Cell(9, 2).Range.Font.Bold = 0;
184
+        newTable.Cell(9, 1).Height = 140f;
185
+        newTable.Cell(9, 2).Height = 140f;
159
         WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
186
         WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
160
         object unite = MSWord.WdUnits.wdStory;
187
         object unite = MSWord.WdUnits.wdStory;
161
 
188
 
162
         WordApp.Selection.EndKey(ref unite, ref Nothing); //将光标移动到文档末尾
189
         WordApp.Selection.EndKey(ref unite, ref Nothing); //将光标移动到文档末尾
163
 
190
 
164
-        WordDoc.Content.InsertAfter("联系电话:" + "(0372)12345" + "                        "
165
-        + "    审核员:" + usercode + "                   " + "       调度员:" + user);
191
+        WordDoc.Content.InsertAfter("联系电话:" + "(0372)12345"+ "                " + "审核员:" + usercode + "         " + "       调度员:" + user);
166
         string FileName = "/Upload/Word/" + "/word.png";
192
         string FileName = "/Upload/Word/" + "/word.png";
167
         FileName = HttpContext.Current.Server.MapPath("..") + FileName;
193
         FileName = HttpContext.Current.Server.MapPath("..") + FileName;
168
         newTable.Cell(6, 2).Select();//选中一行 
194
         newTable.Cell(6, 2).Select();//选中一行 
173
         WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor);
199
         WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor);
174
        WordDoc.Application.ActiveDocument.InlineShapes[1].Width = 120f;//图片宽度 
200
        WordDoc.Application.ActiveDocument.InlineShapes[1].Width = 120f;//图片宽度 
175
        WordDoc.Application.ActiveDocument.InlineShapes[1].Height =120f;//图片高 
201
        WordDoc.Application.ActiveDocument.InlineShapes[1].Height =120f;//图片高 
176
-        WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().IncrementLeft(380.0f);//图片位置
202
+        WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().IncrementLeft(300.0f);//图片位置
177
        // WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapBehind;
203
        // WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape().WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapBehind;
178
 
204
 
179
        
205