Hello, I am using aspose.words to create Word documents in a c# web application. When I run the code the locally on my pc the doc creates great. However, when I run from my server it creates a blank document. I have adjusted security on the folder c:\loans. I suspect it is a security issue but do not know what else to modify. I given Network Service modify access. Thank you for looking
case “Word”:
{
FileInfo templateFile = new FileInfo(inputFilePath);
FileInfo outputFile = new FileInfo(“C:\loans\test.doc”);
Object oTemplateDocument = templateFile.FullName;
Object oOutputDocument = outputFile.FullName;
// Create Word application instance
Word.Application wordApp = null;
Word.Document wordDoc = null;
try
{
wordApp = new Word.Application();
wordApp.Visible = false;
wordDoc = wordApp.Documents.Add(ref oTemplateDocument, Missing.Value, Missing.Value, Missing.Value);
// Go through each range (header, body, etc)…
foreach (Word.Range range in wordDoc.StoryRanges)
{
// Go through each Content Control field…
foreach (Word.ContentControl control in range.ContentControls)
{
// Try to find a match in the DB of how to populate this field…
WorkbookField field = fields.Where(f => f.FieldName == control.Title)
.Select(f => f)
.DefaultIfEmpty(null)
.FirstOrDefault();