using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MSWord = Microsoft.Office.Interop.Word;
using System.IO;
using System.Reflection;
using Microsoft.Office.Interop.Word;
using System.Threading;
using IWshRuntimeLibrary;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public void zuo()
{
DateTime.Now.ToString();
string i = DateTime.Now.ToLocalTime().ToString();
label1.Text = i;
xxx.app.Visible = true;
object oMissing = System.Reflection.Missing.Value;
object format = MSWord.WdSaveFormat.wdFormatDocument;
if (System.IO.File.Exists(@"C://Users//Administrator//Desktop//Test.doc"))
{
label2.Text = "666";
xxx.wordDoc = xxx.app.Documents.Open(ref xxx.c, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
xxx.app.Visible = true;
int ip = xxx.wordDoc.Tables.Count;
Microsoft.Office.Interop.Word.Table nowTable = xxx.wordDoc.Tables[ip];
int ip6 = nowTable.Rows.Count;
DateTime.Now.ToString();
string da = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd");
int i6 = 1;
xxx.i = ip6 + 1;
int day = (int)DateTime.Now.DayOfWeek;
string[] weekday ={
"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" };
string week = weekday[Convert.ToInt32(DateTime.Now.DayOfWeek)];
string[] kaishishijian ={
"8:00", "17:00", "17:00", "17:00", "17:00", "17:00", "8:00" };
string kaishi = kaishishijian[Convert.ToInt32(DateTime.Now.DayOfWeek)];
string[] zhibanxingzhi ={
"周末", "延值", "延值", "延值", "延值", "延值", "周末" };
string zhiban = zhibanxingzhi[Convert.ToInt32(DateTime.Now.DayOfWeek)];
string[] zhibanshichang ={
"12", "3", "3", "3", "3", "3", "12" };
string shichang = zhibanshichang[Convert.ToInt32(DateTime.Now.DayOfWeek)];
object count = 9999;
object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;
xxx.app.Selection.MoveDown(ref WdLine, ref count, ref oMissing);
Microsoft.Office.Interop.Word.Table newTable = xxx.wordDoc.Tables.Add(xxx.app.Selection.Range, 1, 7, ref oMissing, ref oMissing);
newTable.Borders.OutsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleSingle;
newTable.Borders.InsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleSingle;
newTable.Range.ParagraphFormat.Alignment = MSWord.WdParagraphAlignment.wdAlignParagraphCenter;
newTable.Range.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalCenter;
newTable.Cell(xxx.i, 1).Range.Text = da;
newTable.Cell(xxx.i, 1).Range.Bold = 2;
newTable.Cell(xxx.i, 2).Range.Text = kaishi;