TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Imran Shaw
NA
1
4.4k
interop word insert page break
Dec 16 2014 1:07 PM
I am writing a program that loops through an array to write a report in MsWord. When a certain value is encountered I would like to insert a page break. I only want the courses of a subject code list on one page.
example of output desired:
AHS 20112
AHS 20114
BREAK
BUS 20024
BUS 20025
BUS 20154
BUS 20187
BREAK
CRJ 20006
CRJ 20009
etc...
foreach (FacultyElements F in db._DataHolder)
{
if (PreviousSubCode == string.Empty)
{
Debug.WriteLine(F.subjCode + " " + F.CRN);
}
else
{
r++;
if (PreviousSubCode == F.subjCode)
{
Debug.WriteLine(F.subjCode + " " + F.CRN);
objTable.Cell(r, 1).Range.Text = F.subjCode;
objTable.Cell(r, 2).Range.Text = F.sessCode;
objTable.Cell(r, 3).Range.Text = F.courseNum;
objTable.Cell(r, 4).Range.Text = F.seqNum;
objTable.Cell(r, 5).Range.Text = F.PtrmCode;
objTable.Cell(r, 6).Range.Text = F.CRN;
objTable.Cell(r, 7).Range.Text = F.courseTitle;
//dual fields
objTable.Cell(r, 8).Range.Text = "";
objTable.Cell(r, 9).Range.Text = "";
objTable.Cell(r, 10).Range.Text = "";
objTable.Cell(r, 11).Range.Text = F.CourseHours;
}
else
{
Debug.WriteLine("BREAK");
Debug.WriteLine(F.subjCode + " " + F.CRN);
objTable.Cell(r, 1).Range.Text = F.subjCode;
objTable.Cell(r, 2).Range.Text = F.sessCode;
objTable.Cell(r, 3).Range.Text = F.courseNum;
objTable.Cell(r, 4).Range.Text = F.seqNum;
objTable.Cell(r, 5).Range.Text = F.PtrmCode;
objTable.Cell(r, 6).Range.Text = F.CRN;
objTable.Cell(r, 7).Range.Text = F.courseTitle;
//dual fields
objTable.Cell(r, 8).Range.Text = "";
objTable.Cell(r, 9).Range.Text = "";
objTable.Cell(r, 10).Range.Text = "";
objTable.Cell(r, 11).Range.Text = F.CourseHours;
}
}
PreviousSubCode = F.subjCode;
}
Reply
Answers (
1
)
Invalid column name 'Image'.?
Is this write code to chck prime num?if wrong plz tell m bst