[]
        
(Showing Draft Content)

Parsing Documents

C1Word parses and modifies existing Word documents at runtime. Applications access document elements through the C1Word.MainSection object to inspect and update document content.

The following example shows how to access individual elements:

// load the document  
var doc = new C1WordDocument();  
doc.Load("file path.docx");  

// document's information  
var info = doc.Info;  
var a = info.Author + info.Company + info.CreationTime.ToString();  

// document's structure  
foreach (var obj in doc.MainSection.Header)  
{  
// header objects  
}  
foreach (var obj in doc.MainSection.Content)  
{  
// content objects  
}  
foreach (var obj in doc.MainSection.Footer)  
{  
// footer objects  
}  
foreach (var obj in doc.MainSection.Columns)  
{  
// columns  
}  

// page size  
var sz = doc.MainSection.PageSize;  

// margins  
var lm = doc.MainSection.LeftMargin;  
var rm = doc.MainSection.RightMargin;  
var tm = doc.MainSection.TopMargin;  
var bm = doc.MainSection.BottomMargin;