using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.InfoPath.Server;
using Microsoft.Office;
using System.Data;
using Microsoft.Office.Interop.InfoPath.Xml;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.InfoPath;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Application myApp = new Microsoft.Office.Interop.InfoPath.Application();
XDocumentsCollection myXDocs = myApp.XDocuments;
XDocument myXDoc = myXDocs.Open("C:\\Test\\Form1.xml",
(int)XdDocumentVersionMode.xdFailOnVersionOlder);
IXMLDOMDocument2 myXMLDoc = myXDoc.DOM as IXMLDOMDocument2;
myXMLDoc.setProperty("SelectionNamespaces",
"xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-08-18T14:11:04'");
IXMLDOMNodeList myNames =
myXMLDoc.selectNodes(
"//my:customerName[. = 'Company A']");
if (myNames.length < 1)
Console.WriteLine(
"No elements containing 'Company A' were found.");
IXMLDOMNode myName = myNames.nextNode();
while (myName != null)
{
myName.text = "Company B";
myName = myNames.nextNode();
}
myXDoc.SaveAs("C:\\Test\\Form2.xml");
myXDocs.Close(0);
myApp.Quit(false);
Console.WriteLine("Finished!");
}
}
}
Reference Link: Automate Changing the Value of a Field
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.InfoPath.Server;
using Microsoft.Office;
using System.Data;
using Microsoft.Office.Interop.InfoPath.Xml;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.InfoPath;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Application myApp = new Microsoft.Office.Interop.InfoPath.Application();
XDocumentsCollection myXDocs = myApp.XDocuments;
XDocument myXDoc = myXDocs.Open("C:\\Test\\Form1.xml",
(int)XdDocumentVersionMode.xdFailOnVersionOlder);
IXMLDOMDocument2 myXMLDoc = myXDoc.DOM as IXMLDOMDocument2;
myXMLDoc.setProperty("SelectionNamespaces",
"xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-08-18T14:11:04'");
IXMLDOMNodeList myNames =
myXMLDoc.selectNodes(
"//my:customerName[. = 'Company A']");
if (myNames.length < 1)
Console.WriteLine(
"No elements containing 'Company A' were found.");
IXMLDOMNode myName = myNames.nextNode();
while (myName != null)
{
myName.text = "Company B";
myName = myNames.nextNode();
}
myXDoc.SaveAs("C:\\Test\\Form2.xml");
myXDocs.Close(0);
myApp.Quit(false);
Console.WriteLine("Finished!");
}
}
}
Reference Link: Automate Changing the Value of a Field
1672F0593D
ReplyDeletekiralık hacker
hacker arıyorum
belek
kadriye
serik
83CD8BB56F
ReplyDeletehacker kirala
hacker kiralama
tütün dünyası
hacker bul
hacker kirala
BF96D2DE09
ReplyDeleteyabancı takipçi
henry modern swivel accent chair
E7024D5E
ReplyDeleteKayapınar
Artuklu
Ömerli
Burhaniye
Kemalpaşa
Kızıltepe
Karşıyaka
Ünye
Nizip