A
ACFalcon
I have a fairly large Word document that a .NET page creates......between 2
and 10 MB depending on what the user selects. The problem is that the file
works great if I am just inserting text, but if I try to build a table in
word all of a sudden the file takes sometimes up to 30 minutes (100% CPU
Usage) to be created. I cut out the code to create the tables and everything
runs fairly quickly (less than 5 minutes). Here is a sample of the table
creation code. I know my .NET datatables are not the issue, because I can
load and read them fine in a matter of seconds.
oWT = oDoc.Sections(a).Range.Tables.Add(oDoc.Sections(a).Range,
oDT.Rows.Count + 1, 3)
With oWT.Rows(1)
.Cells(1).Delete()
.Cells(1).Range.Text = "DATABASE: " &
oParent.Attributes("Database").Value
.Cells(1).WordWrap = True
.Cells(1).Range.Font.Bold = True
.Cells(1).Width = 300
.Cells(2).Range.Text = "TABLE: " &
oParent.Attributes("Name").Value
.Cells(2).WordWrap = True
.Cells(2).Range.Font.Bold = True
.Cells(2).Width = 300
End With
c = 2
For Each oDRW In oDT.Rows
With oWT.Rows(c)
.Cells(1).Delete()
.Cells(1).Delete()
.Cells(1).Range.Text = oDRW("Text")
.Cells(1).WordWrap = True
.Cells(1).Width = 600
.Shading.BackgroundPatternColor =
WdColor.wdColorWhite
End With
c += 1
Next
Does anyone have any ideas why this is SO slow?!
Thanks,
Adam
and 10 MB depending on what the user selects. The problem is that the file
works great if I am just inserting text, but if I try to build a table in
word all of a sudden the file takes sometimes up to 30 minutes (100% CPU
Usage) to be created. I cut out the code to create the tables and everything
runs fairly quickly (less than 5 minutes). Here is a sample of the table
creation code. I know my .NET datatables are not the issue, because I can
load and read them fine in a matter of seconds.
oWT = oDoc.Sections(a).Range.Tables.Add(oDoc.Sections(a).Range,
oDT.Rows.Count + 1, 3)
With oWT.Rows(1)
.Cells(1).Delete()
.Cells(1).Range.Text = "DATABASE: " &
oParent.Attributes("Database").Value
.Cells(1).WordWrap = True
.Cells(1).Range.Font.Bold = True
.Cells(1).Width = 300
.Cells(2).Range.Text = "TABLE: " &
oParent.Attributes("Name").Value
.Cells(2).WordWrap = True
.Cells(2).Range.Font.Bold = True
.Cells(2).Width = 300
End With
c = 2
For Each oDRW In oDT.Rows
With oWT.Rows(c)
.Cells(1).Delete()
.Cells(1).Delete()
.Cells(1).Range.Text = oDRW("Text")
.Cells(1).WordWrap = True
.Cells(1).Width = 600
.Shading.BackgroundPatternColor =
WdColor.wdColorWhite
End With
c += 1
Next
Does anyone have any ideas why this is SO slow?!
Thanks,
Adam