public string CreateWordFile()
{
string message = "";
try
{
Object Nothing = ;
string name = "";
object filename = @"C:\Users\xiehuan\xxx\" + name; //File saving path
//Create Word Document
WordApp = new ();
WordDoc = (ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//Add a header
= ;
= ;
("[header content]");
= ;//Set right alignment
= ;//Bounce out of header settings
= 15f;//Set the line spacing of the document
//Move the focus and wrap the line
object count = 14;
object WdLine = ;//change one line;
(ref WdLine, ref count, ref Nothing);//Move focus
();//Insert paragraph
//Create a table in the document
newTable = (, 12, 3, ref Nothing, ref Nothing);
//Set the table style
= ;
= ;
[1].Width = 100f;
[2].Width = 220f;
[3].Width = 105f;
//Fill in the form content
(1, 1). = "Product Details Table";
(1, 1). = 2;//Set the font in the cell to bold
//Merge cells
(1, 1).Merge((1, 3));
= ;// Vertical center
= ;//Center horizontally
//Fill in the form content
(2, 1). = "Product Basic Information";
(2, 1). = ;//Set the font color in the cell
//Merge cells
(2, 1).Merge((2, 3));
= ;
//Fill in the form content
(3, 1). = "Brand Name:";
(3, 2). = "BrandName";
//Merge cells vertically
(3, 3).Select();//Select a line
object moveUnit = ;
object moveCount = 5;
object moveExtend = ;
(ref moveUnit, ref moveCount, ref moveExtend);
();
//Insert the picture
string FileName = Picture;//Path where the picture is located
object LinkToFile = false;
object SaveWithDocument = true;
object Anchor = ;
(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor);
[1].Width = 100f;//Picture width
[1].Height = 100f;//Picture height
//Set the picture to surrounding
s = [1].ConvertToShape();
= ;
(12, 1). = "Product Special Attributes";
(12, 1).Merge((12, 3));
//Add rows in the table
[1].(ref Nothing);
= "Document creation time:" + ();//"Sign up"
= ;
//Save file
(ref filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
(ref Nothing, ref Nothing, ref Nothing);
(ref Nothing, ref Nothing, ref Nothing);
message=name+"The document was generated successfully to save to C:CNSI";
}
catch ( e)
{
();
}
return message;
}