@@ -531,7 +531,7 @@ public void TestIssue5()
531531 }
532532
533533 [ Fact ]
534- public void TestIssue_MiniWordHyperLinkList ( )
534+ public void MiniWordHyperLink_List ( )
535535 {
536536 var path = PathHelper . GetTempFilePath ( ) ;
537537 var templatePath = PathHelper . GetFile ( "TestBasicFill.docx" ) ;
@@ -543,7 +543,7 @@ public void TestIssue_MiniWordHyperLinkList()
543543 Text = "測試連結22!!"
544544 } ,
545545 new MiniWordHyperLink ( ) {
546- Url = "https://google .com" ,
546+ Url = "https://google1 .com" ,
547547 Text = "測試連結11!!"
548548 }
549549 } ,
@@ -555,11 +555,88 @@ public void TestIssue_MiniWordHyperLinkList()
555555 } ;
556556 MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
557557 //Console.WriteLine(path);
558- var xml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
559- Assert . DoesNotContain ( "Jack Demo APP Account Data" , xml ) ;
560- Assert . Contains ( "MiniSofteware Demo APP Account Data" , xml ) ;
561- Assert . Contains ( "MiniSofteware Demo APP Account Data" , xml ) ;
562- Assert . Contains ( "<w:hyperlink w:tgtFrame=\" _blank\" " , xml ) ;
558+ var docXml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
559+ Assert . DoesNotContain ( "Jack Demo APP Account Data" , docXml ) ;
560+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
561+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
562+ Assert . Contains ( "<w:hyperlink w:tgtFrame=\" _blank\" " , docXml ) ;
563+
564+ var relsXml = Helpers . GetZipFileContent ( path , "word/_rels/document.xml.rels" ) ;
565+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google.com\" " , relsXml ) ;
566+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google1.com\" " , relsXml ) ;
567+ }
568+
569+
570+ [ Fact ]
571+ public void MiniWordHyperLink_Array ( )
572+ {
573+ var path = PathHelper . GetTempFilePath ( ) ;
574+ var templatePath = PathHelper . GetFile ( "TestBasicFill.docx" ) ;
575+ var value = new Dictionary < string , object > ( )
576+ {
577+ [ "Name" ] = new MiniWordHyperLink [ ] {
578+ new MiniWordHyperLink ( ) {
579+ Url = "https://google.com" ,
580+ Text = "測試連結22!!"
581+ } ,
582+ new MiniWordHyperLink ( ) {
583+ Url = "https://google1.com" ,
584+ Text = "測試連結11!!"
585+ }
586+ } ,
587+ [ "Company_Name" ] = "MiniSofteware" ,
588+ [ "CreateDate" ] = new DateTime ( 2021 , 01 , 01 ) ,
589+ [ "VIP" ] = true ,
590+ [ "Points" ] = 123 ,
591+ [ "APP" ] = "Demo APP" ,
592+ } ;
593+ MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
594+
595+ var docXml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
596+ Assert . DoesNotContain ( "Jack Demo APP Account Data" , docXml ) ;
597+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
598+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
599+ Assert . Contains ( "<w:hyperlink w:tgtFrame=\" _blank\" " , docXml ) ;
600+
601+ var relsXml = Helpers . GetZipFileContent ( path , "word/_rels/document.xml.rels" ) ;
602+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google.com\" " , relsXml ) ;
603+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google1.com\" " , relsXml ) ;
604+ }
605+
606+ [ Fact ]
607+ public void MiniWordHyperLink_AnonymousArray ( )
608+ {
609+ var path = PathHelper . GetTempFilePath ( ) ;
610+ var templatePath = PathHelper . GetFile ( "TestBasicFill.docx" ) ;
611+ var value = new Dictionary < string , object > ( )
612+ {
613+ [ "Name" ] = new [ ] {
614+ new MiniWordHyperLink ( ) {
615+ Url = "https://google.com" ,
616+ Text = "測試連結22!!"
617+ } ,
618+ new MiniWordHyperLink ( ) {
619+ Url = "https://google1.com" ,
620+ Text = "測試連結11!!"
621+ }
622+ } ,
623+ [ "Company_Name" ] = "MiniSofteware" ,
624+ [ "CreateDate" ] = new DateTime ( 2021 , 01 , 01 ) ,
625+ [ "VIP" ] = true ,
626+ [ "Points" ] = 123 ,
627+ [ "APP" ] = "Demo APP" ,
628+ } ;
629+ MiniWord . SaveAsByTemplate ( path , templatePath , value ) ;
630+
631+ var docXml = Helpers . GetZipFileContent ( path , "word/document.xml" ) ;
632+ Assert . DoesNotContain ( "Jack Demo APP Account Data" , docXml ) ;
633+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
634+ Assert . Contains ( "MiniSofteware Demo APP Account Data" , docXml ) ;
635+ Assert . Contains ( "<w:hyperlink w:tgtFrame=\" _blank\" " , docXml ) ;
636+
637+ var relsXml = Helpers . GetZipFileContent ( path , "word/_rels/document.xml.rels" ) ;
638+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google.com\" " , relsXml ) ;
639+ Assert . Contains ( "<Relationship Type=\" http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\" https://google1.com\" " , relsXml ) ;
563640 }
564641
565642 /// <summary>
0 commit comments