Ejemplo n.º 1
0
 public void GetDropDownlistOldVersion()
 {
     using (WordCore wordCore = new WordCore())
     {
         wordCore.OpenWord(@"C:\Users\Administrator\Desktop\新建 Microsoft Word 97 - 2003 文档.doc");
         wordCore.Set_DropDownList_SelectedText("d3", "2");
     }
 }
Ejemplo n.º 2
0
        public void CopyTest()
        {
            string reasonFile   = @"C:\Users\Administrator\Desktop\GenerateLetter\PW + ER Reason.doc";
            string templateFile = @"C:\Users\Administrator\Desktop\GenerateLetter\(chi) ER but missing information.doc";

            using (WordCore wordCore = new WordCore())
            {
                wordCore.Copy(templateFile, @"C:\Users\Administrator\Desktop\GenerateLetter\(chi) ER but missing informationTest1.doc");
            }

            string len = "\r\newrwer";
        }
Ejemplo n.º 3
0
        public void CreateWordTest()
        {
            string path = directory + "\\create";

            if (File.Exists((string)path))
            {
                File.Delete((string)path);
            }
            using (WordCore wordCore = new WordCore())
            {
                wordCore.CreateWord(path);
            }
        }
Ejemplo n.º 4
0
        public void LetterGenerationTest()
        {
            EmployeeInfo employee = new EmployeeInfo()
            {
                address = "陕西省西安市雁塔区天谷八路环普科技园1", eRID = "HR342389", language = "C", name = "Haley", title = "TestMessage"
            };
            EmployerInfo employer = new EmployerInfo()
            {
                schemeName = "计划名称", name = "中软国际", schemeNumber = "901213", schemeCode = "CHNSOFT", language = "C", eRID = "HR565", address = "陕西省西安市雁塔区天谷八路环普科技园2"
            };

            string reasonFile   = @"C:\Users\Administrator\Desktop\GenerateLetter\PW + ER Reason.doc";
            string templateFile = @"C:\Users\Administrator\Desktop\GenerateLetter\(chi) ER but missing informationTest.doc";

            //if Language=="C" worLettertableIndex=3 Language=="E"  worLettertableIndex=4
            int        worLettertableIndex = 3;
            ReasonInfo reasoninfo          = new ReasonInfo();

            using (WordCore wordCore = new WordCore())
            {
                wordCore.OpenWord(reasonFile, true);
                IList <string> codes      = wordCore.GetTable_Clolumn_ByColumnIndex(1, 1);
                IList <string> shortCodes = wordCore.GetTable_Clolumn_ByColumnIndex(1, 2);
                for (int i = 0; i < codes.Count; i++)
                {
                    reasoninfo.Reasons.Add(new SelectReasonItem
                    {
                        Code       = codes[i],
                        ShortCode  = shortCodes[i],
                        Row        = i + 2,
                        CopyColumn = 3
                    });
                }
                foreach (SelectReasonItem item in reasoninfo.Reasons)
                {
                    wordCore.CopyTable_Cell_ByRowIndexAndColumnIndex(1, item.Row, item.CopyColumn);
                    wordCore.OpenWord(templateFile);
                    wordCore.AppendPasteContentToTable(worLettertableIndex);
                    wordCore.OpenWord(reasonFile, true);
                }
                wordCore.ProtectDocument(templateFile);
            }
        }