Пример #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     // Loops through each user.
     for (int i = 0; i <= users.GetLength(0) - 1; i++)
     {
         // If the user matches and ends in 1, give admin permissions.
         if (users[i, 0] == txtUser.Text + "1" && users[i, 1] == txtPass.Text)
         {
             main = new formMain(i, 1);
             main.Show();
             this.Hide();
             break;
             // If the user matches and ends in 0, give normal user permissions.
         }
         else if (users[i, 0] == txtUser.Text + "0" && users[i, 1] == txtPass.Text)
         {
             main = new formMain(i, 0);
             main.Show();
             this.Hide();
             break;
         }
         else if (i == users.GetLength(0) - 1)
         {
             msgbox msg = new msgbox("Invalid username or password.", "Error", 1, Color.DarkRed);
             msg.Show();
         }
     }
 }
Пример #2
0
        void delStudent()
        {
            // Prompt the user before deleting student.
            delConf = new msgbox("Are you sure you want to delete " + students[currentView, 1] + " " + students[currentView, 2] + "?", "Delete", 2);
            delConf.ShowDialog();

            if (delConf.DialogResult == DialogResult.Yes)
            {
                // Log the deletion of the student.
                File.AppendAllText(Path.Combine(specificFolder, "log.fbla"), "[D]\\" +
                                   rformLogin.users[currentUser, 0].Substring(0, rformLogin.users[currentUser, 0].Length - 1)
                                   + '\\' + "student\\" + students[currentView, 1] + " " + students[currentView, 2]
                                   + '\\' + DateTime.Now.ToShortDateString() + '\\' + DateTime.Now.ToShortTimeString() + "\r\n");

                // String used to find the student inside the student file.
                string _contains = students[currentView, 1] + '\\' + students[currentView, 2] + '\\'
                                   + students[currentView, 3] + '\\';
                // Delete the line that contains _contains in the given source.
                delete(_contains, specificFolder + "/data/students.fbla", false);

                // Reset the students array and treeview.
                readToArray(specificFolder + "/data/students.fbla", students, "NA");
                refreshStudentTree("");
            }
        }
Пример #3
0
        void writeUser(string user, string pass, string first, string last, string email)
        {
            // Writes the text to the user file.
            File.AppendAllText(specificFolder + "/users.fbla", rformLogin.Encrypt(user + '\\' + pass + '\\' + first + '\\' + last + '\\' + email) + "\r\n");

            // Logs the new user.
            File.AppendAllText(Path.Combine(specificFolder, "log.fbla"), "[A]\\" +
                               rformLogin.users[currentUser, 0].Substring(0, rformLogin.users[currentUser, 0].Length - 1) +
                               "\\user\\" + user.Substring(0, user.Length - 1) + '\\' + DateTime.Now.ToShortDateString() +
                               '\\' + DateTime.Now.ToShortTimeString() + "\r\n");

            // Sets the user number for the new user and the
            // username without the permission number.
            int    newUserNum = rformLogin.userNums.Count() + 1;
            string rawUser    = user.Substring(0, user.Length - 1);

            // Adds the new user to the users array and listbox.
            listUsers.Items.Add(rawUser);
            rformLogin.userNums.Add(rawUser, newUserNum);
            rformLogin.users[newUserNum, 0] = user; rformLogin.users[newUserNum, 1] = pass; rformLogin.users[newUserNum, 2] = first;
            rformLogin.users[newUserNum, 3] = last; rformLogin.users[newUserNum, 4] = email;
            msgbox msg = new msgbox(txtUsername.Text + " was successfully created!", "Success", 1);

            msg.Show();
        }
Пример #4
0
        private void btnAddAll_Click(object sender, EventArgs e)
        {
            bool GO        = false;
            int  rowsToUse = dQuickList.Rows.Count - 1;

            String[,] tempStudents = new String[rowsToUse, 12];
            String[] newStudents = new String[rowsToUse];
            for (int i = 0; i < rowsToUse; i++)
            {
                for (int j = 0; j < tempStudents.GetLength(1); j++)
                {
                    try {
                        if ((tempStudents[i, j] = dQuickList.Rows[i].Cells[j].Value.ToString()) != "" || j == 10)
                        {
                            if (j == 5 || j == 6)
                            {
                                switch (tempStudents[i, j])
                                {
                                case "M": tempStudents[i, j] = "1"; break;

                                case "F": tempStudents[i, j] = "0"; break;

                                case "Yes": tempStudents[i, j] = "1"; break;

                                case "No": tempStudents[i, j] = "0"; break;
                                }
                            }
                            GO = true;
                        }
                    } catch
                    {
                        msgbox msg = new msgbox("Please ensure all required entries are filled.", "Error", 1, Color.DarkRed);
                        msg.Show();
                        GO = false; break;
                    }
                }
            }

            if (GO)
            {
                for (int j = 0; j < tempStudents.GetLength(0); j++)
                {
                    for (int i = 0; i < tempStudents.GetLength(1) - 1; i++)
                    {
                        newStudents[j] += tempStudents[j, i] + "\\";
                    }
                    newStudents[j] += tempStudents[j, tempStudents.GetLength(1) - 1] + "\r\n";
                }

                foreach (String str in newStudents)
                {
                    File.AppendAllText(studentFile, str);
                }

                dQuickList.Rows.Clear();
                msgbox msg = new msgbox("Successfully added " + rowsToUse.ToString() + " student(s).", "Sucess", 1);
                msg.Show();
            }
        }
Пример #5
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     _conf = new msgbox("Are you sure you want to clear all data?", "Erase Data?", 2);
     _conf.ShowDialog();
     if (_conf.DialogResult == DialogResult.Yes)
     {
         clearNewStudent();
     }
 }
Пример #6
0
 private void clearToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (logClearConf.ShowDialog() == DialogResult.Yes)
     {
         File.Delete(Path.Combine(specificFolder, "log.fbla"));
         File.Create(Path.Combine(specificFolder, "log.fbla")).Dispose();
         log.Clear();
         msgbox msg = new msgbox("Successfully cleared the log.", "Success", 1);
         msg.Show();
         listLog.Items.Clear();
     }
 }
Пример #7
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     // Creates the new user if all fields throw no errors.
     if (userOk && passOk && emailOk && txtFirstname.Text !=
         rformLogin.placeText[txtFirstname] && txtLastname.Text != rformLogin.placeText[txtLastname])
     {
         writeUser(txtUsername.Text + cmbPerms.SelectedIndex.ToString(), txtPassconf.Text, txtFirstname.Text, txtLastname.Text, txtEmail.Text);
     }
     else
     {
         msgbox msg = new msgbox("Please make sure all entries are complete and correct.", "Error", 1);
         msg.Show();
     }
 }
Пример #8
0
        private void listLog_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listLog.SelectedIndex;

            try
            {
                // Show extra log information.
                msgbox msg = new msgbox("'" + log[index, 1] + "' " + logEvent(log[index, 0])
                                        + " the " + log[index, 2] + " '" + log[index, 3]
                                        + "' on " + log[index, 4] + " at " + log[index, 5]
                                        + ".", "Log Info", 1);
                msg.Show();
            }
            catch { }
        }
Пример #9
0
 void newStudent()
 {
     _conf = new msgbox("Creating a new user will erase any filled in data.", "Erase Data?", 2);
     if (!firstNew)
     {
         _conf.ShowDialog();
     }
     if (_conf.DialogResult == DialogResult.Yes || firstNew)
     {
         editing  = false;
         firstNew = false;
         clearNewStudent();
         if (!txtNewFirst.Enabled)
         {
             enableNewStudent(true);
             // Generate next member number in the chain (Probably temporary).
             nmNewMemNum.Value = Convert.ToDecimal(studentLength + 1);
         }
     }
 }
Пример #10
0
        private void btnCopyQf_Click(object sender, EventArgs e)
        {
            string _temp = "";

            // Generate the necesarry quickFind string.
            for (int i = 0; i < 11; i++)
            {
                _temp += students[currentView, i];
                if (i != 10)
                {
                    _temp += "\\";
                }
            }

            // Copy the string to the clipboard.
            Clipboard.SetText(_temp);
            msgbox msg = new msgbox("Successfully copied " + students[currentView, 1] + " " + students[currentView, 2] + " to clipboard!", "Success", 1);

            msg.Show();
        }
Пример #11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool worked       = false;
            int  newMemberNum = memberNum - 1;

            try {
                String[] _check = txtAdd.Text.Split('\\');
                string   _temp  = "";
                _check[0] = memberNum.ToString();
                if (_check.Length == 11)
                {
                    for (int i = 0; i < 11; i++)
                    {
                        _temp += _check[i];
                        formMain.students[newMemberNum, i] = _check[i];
                        if (i != 10)
                        {
                            _temp += '\\';
                        }
                    }
                    File.AppendAllText(studentFile, _temp + "\r\n");
                    txtAdd.Clear();
                    msgbox msg = new msgbox("Successfully added " + _check[1] + " " + _check[2] + ".", "Success", 1);
                    msg.Show();
                    added = true;
                    memberNum++;
                    worked = true;
                }
            } catch { }

            if (!worked)
            {
                msgbox msg = new msgbox("The data you have entered is not formatted correctly, please be sure you are only using data that has been copied from any copy of Citadel.", "Error", 1, Color.DarkRed);
                msg.Show();
            }
        }
Пример #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // Check that all required fields have been filled.
            if (txtNewFirst.Text != "" && txtNewLast.Text != "" && txtNewSchool.Text != "" && txtNewEmail.Text != "")
            {
                if (editing)
                {
                    int    _student = editStudent;
                    string _del     = "";
                    for (int i = 0; i < 5; i++)
                    {
                        _del += students[_student, i];
                        _del += "\\";
                    }
                    delete(_del, specificFolder + "/data/students.fbla", false);
                }

                // Temporary strings for parsing the integer values to strings.
                string _active = ""; string _gender = ""; string _grade;
                switch (!active)
                {
                case true: _active = "1"; break;

                case false: _active = "0"; break;
                }
                switch (!gender)
                {
                case true: _gender = "1"; break;

                case false: _gender = "0"; break;
                }
                if (lblGradeSel.Text != "13+")
                {
                    _grade = lblGradeSel.Text;
                }
                else
                {
                    _grade = "13";
                }

                // The string that will be saved.
                string _temp = nmNewMemNum.Text + '\\' + txtNewFirst.Text + '\\' + txtNewLast.Text + '\\' + txtNewFees.Text
                               + '\\' + nmNewYear.Text + '\\' + _active + '\\' + _gender + '\\' + _grade
                               + '\\' + txtNewSchool.Text + '\\' + txtNewEmail.Text + '\\' + txtNewComment.Text + '\\' + cmbState.Text;

                try
                {
                    // Write the student to the source.
                    File.AppendAllText(specificFolder + "/data/students.fbla", _temp + "\r\n");

                    // Add the new student to the array.
                    studentLength++;
                    readToArray(specificFolder + "/data/students.fbla", students, "NA");
                    refreshStudentTree("");
                    if (!editing)
                    {
                        // Log the addition of the student.
                        File.AppendAllText(Path.Combine(specificFolder, "log.fbla"), "[A]\\" +
                                           rformLogin.users[currentUser, 0].Substring(0, rformLogin.users[currentUser, 0].Length - 1)
                                           + '\\' + "student\\" + txtNewFirst.Text + " " + txtNewLast.Text
                                           + '\\' + DateTime.Now.ToShortDateString() + '\\' + DateTime.Now.ToShortTimeString() + "\r\n");

                        msgbox msg = new msgbox("Successfully added " + txtNewFirst.Text + " " + txtNewLast.Text + ".", "Success", 1);
                        msg.Show();
                    }
                    else
                    {
                        File.AppendAllText(Path.Combine(specificFolder, "log.fbla"), "[E]\\" +
                                           rformLogin.users[currentUser, 0].Substring(0, rformLogin.users[currentUser, 0].Length - 1)
                                           + '\\' + "student\\" + txtNewFirst.Text + " " + txtNewLast.Text
                                           + '\\' + DateTime.Now.ToShortDateString() + '\\' + DateTime.Now.ToShortTimeString() + "\r\n");
                    }

                    // Reset the new student form.
                    editing = false;
                    clearNewStudent();
                    enableNewStudent(false);
                    firstNew = true;
                }
                catch
                {
                    msgbox msg = new msgbox("Error writing student to the selected source.", "Error", 1);
                    msg.Show();
                }
            }
            else
            {
                msgbox msg = new msgbox("Please ensure that all of the required entries have been filled in.", "Error", 1);
                msg.Show();
            }
        }
Пример #13
0
        void updateStatistics()
        {
            if (studentLength != 0)
            {
                try
                {
                    // Show the bar graphs.
                    pnlgMale.Show(); pnlgFemale.Show();
                    pnlgActive.Show(); pnlgNonactive.Show();
                    pnlgFees.Show(); pnlgNoFees.Show();

                    // Initialize the data on the statistic page.
                    lblStudentCount.Text  = "Total Students: " + studentLength.ToString();
                    lblStudentCount2.Text = studentLength.ToString();
                    totalFees             = 0;

                    // Reinitialize all of the elements.
                    listYears.Items.Clear();
                    listStates.Items.Clear();
                    pnlgActive.Height    = (int)statHeight;
                    pnlgNonactive.Height = (int)statHeight;
                    pnlgMale.Height      = (int)statHeight;
                    pnlgFemale.Height    = (int)statHeight;
                    pnlgFees.Height      = (int)statHeight;
                    pnlgNoFees.Height    = (int)statHeight;

                    // Temporary variables for displaying grade statstics.
                    int _fresh = 0, _soph = 0, _junio = 0, _senio = 0, _colle = 0;
                    hasFees = 0; noFees = 0; aYes = 0; aNo = 0; females = 0; males = 0;
                    List <String> tempYears = new List <String>();
                    List <String> tempState = new List <String>();

                    for (int i = 0; i < students.GetLength(0); i++)
                    {
                        double _temp = 0;
                        if (students[i, 0] == null)
                        {
                            break;
                        }
                        Double.TryParse(students[i, 3].Trim('$'), out _temp);
                        totalFees += _temp;
                        switch (students[i, 7])
                        {
                        case "9": _fresh++; break;

                        case "10": _soph++; break;

                        case "11": _junio++; break;

                        case "12": _senio++; break;

                        case "13+": _colle++; break;
                        }
                        if (students[i, 3] != "$0.00")
                        {
                            hasFees++;
                        }
                        else
                        {
                            noFees++;
                        }
                        if (students[i, 5] == "1")
                        {
                            aYes++;                           // Get the amount of active and nonactive members.
                        }
                        else
                        {
                            aNo++;
                        }
                        if (students[i, 6] == "0")
                        {
                            females++;                        // Get the amount of males and females.
                        }
                        else
                        {
                            males++;
                        }

                        // Check if the list contains the state.
                        if (!tempState.Contains(students[i, 11]))
                        {
                            tempState.Add(students[i, 11]);
                            states[students[i, 11]] = 1;
                        }
                        else
                        {
                            states[students[i, 11]]++;
                        }

                        // Check if the list contains the year.
                        if (!tempYears.Contains(students[i, 4]))
                        {
                            tempYears.Add(students[i, 4]);
                            years[students[i, 4]] = 1;
                        }
                        else
                        {
                            years[students[i, 4]]++;
                        }
                    }

                    // Add the states to the listbox.
                    foreach (String state in tempState)
                    {
                        listStates.Items.Add(state + " :: " + states[state]);
                        cmbReportState.Items.Add(state);
                        cmbReportState.SelectedIndex = 0;
                    }

                    // Add the years to the listbox.
                    foreach (String year in tempYears)
                    {
                        listYears.Items.Add(year + " :: " + years[year]);
                    }

                    string fees             = totalFees.ToString();
                    if (fees.Contains('.'))
                    {
                        switch (fees.Split('.').Length)
                        {
                        case 0: fees += "00"; break;

                        case 1: fees += "0"; break;

                        case 2: break;
                        }
                    }
                    else
                    {
                        fees += ".00";
                    }

                    lblFeesDue.Text        = "Total Fees: $" + fees;
                    lblActiveStudents.Text = "Active Students: " + aYes.ToString();

                    lblgM.Text = "M: " + males.ToString();
                    lblgF.Text = "F: " + females.ToString();

                    lblaYes.Text = "Yes: " + aYes.ToString();
                    lblaNo.Text  = "No: " + aNo.ToString();

                    lblg9.Text  = "9th: " + _fresh.ToString();
                    lblg10.Text = "10th: " + _soph.ToString();
                    lblg11.Text = "11th: " + _junio.ToString();
                    lblg12.Text = "12th: " + _senio.ToString();
                    lblg13.Text = "13+: " + _colle.ToString();

                    // Update the graphs on the statistic page.
                    statPercentage(males, females, pnlgMale, pnlgFemale, lblpMale, lblpFemale);
                    statPercentage(aYes, aNo, pnlgActive, pnlgNonactive, lblpActive, lblpNonactive);
                    statPercentage(hasFees, noFees, pnlgFees, pnlgNoFees, lblpFees, lblpNoFees);
                }
                catch
                {
                    msgbox msg = new msgbox("Citadel was not able to load statistics.", "Error", 1, Color.DarkRed);
                    msg.Show();
                }
            }
        }
Пример #14
0
        private void btnCreateSenior_Click(object sender, EventArgs e)
        {
            var wb = new cXML.XLWorkbook();
            var ws = wb.Worksheets.Add("Members");

            string title = "Senior Report";

            //Title
            ws.Cell("B2").Value = title;

            // Headers
            ws.Cell("B3").Value = "State";
            ws.Cell("C3").Value = "FName";
            ws.Cell("D3").Value = "LName";
            ws.Cell("E3").Value = "Email";

            int skipped = 0;
            int total   = 0;

            // Populate the spreadsheet.
            foreach (string item in cmbReportState.Items)
            {
                skipped = 0;
                for (int i = 4; i - 4 < students.GetLength(0); i++)
                {
                    if (students[i - 4, 0] == null)
                    {
                        break;
                    }
                    if (students[i - 4, 7] == "12" && students[i - 4, 11] == item)
                    {
                        ws.Cell("B" + (i + total - skipped).ToString()).Value = students[i - 4, 11]; // State
                        ws.Cell("C" + (i + total - skipped).ToString()).Value = students[i - 4, 1];  // First Names
                        ws.Cell("D" + (i + total - skipped).ToString()).Value = students[i - 4, 2];  // Last Names
                        ws.Cell("E" + (i + total - skipped).ToString()).Value = students[i - 4, 9];  // Emails
                        total++;
                    }
                    else
                    {
                        skipped++;
                    }
                }
            }

            skipped = studentLength - total;

            //From worksheet
            var rngTable = ws.Range("B2:E" + (studentLength + 5 - skipped).ToString());

            rngTable.FirstCell().Style
            .Font.SetBold()
            .Fill.SetBackgroundColor(cXML.XLColor.CornflowerBlue)
            .Alignment.SetHorizontal(cXML.XLAlignmentHorizontalValues.Center);

            rngTable.FirstRow().Merge();

            var rngHeaders = rngTable.Range("A2:D2"); // The address is relative to rngTable (NOT the worksheet)

            rngHeaders.Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;
            rngHeaders.Style.Font.Bold            = true;
            rngHeaders.Style.Font.FontColor       = cXML.XLColor.DarkBlue;
            rngHeaders.Style.Fill.BackgroundColor = cXML.XLColor.Aqua;

            var rngData    = ws.Range("B3:E" + (studentLength + 5 - skipped).ToString());
            var excelTable = rngData.CreateTable();

            excelTable.ShowTotalsRow = true;

            //Add thick borders to the contents of the spreadsheet
            ws.RangeUsed().Style.Border.OutsideBorder = cXML.XLBorderStyleValues.Thick;

            ws.Columns().AdjustToContents();

            wb.SaveAs(Path.Combine(Application.StartupPath, "SeniorReport.xlsx"));

            msgbox msg = new msgbox("Successfully generated senior report in program's local directory.", "Success", 1);

            msg.Show();
        }
Пример #15
0
        private void btnCreateReport_Click(object sender, EventArgs e)
        {
            var wb = new cXML.XLWorkbook();
            var ws = wb.Worksheets.Add("Members");

            string title = "Citadel Report";

            if (cmbReportState.Text != "All")
            {
                title += " - " + cmbReportState.Text;
            }

            //Title
            ws.Cell("B2").Value = title;

            // Headers
            ws.Cell("B3").Value = "Mem #";
            ws.Cell("C3").Value = "FName";
            ws.Cell("D3").Value = "LName";
            ws.Cell("E3").Value = "Joined";
            ws.Cell("F3").Value = "Grade";
            ws.Cell("G3").Value = "Due";

            int    skipped = 0;
            int    total   = 0;
            int    owing   = 0;
            int    active  = 0;
            Double fees    = 0;
            Double _temp;

            // Populate the spreadsheet.
            for (int i = 4; i - 4 < students.GetLength(0); i++)
            {
                if (students[i - 4, 0] == null)
                {
                    break;
                }
                if ((students[i - 4, 11] == cmbReportState.Text || cmbReportState.Text == "All") && rbAll.Checked || (rbOwing.Checked && students[i - 4, 3] != "$0.00") || (rbPaid.Checked && students[i - 4, 3] == "$0.00"))
                {
                    ws.Cell("B" + (i - skipped).ToString()).Value = students[i - 4, 0]; // Member Numbers
                    ws.Cell("C" + (i - skipped).ToString()).Value = students[i - 4, 1]; // First Names
                    ws.Cell("D" + (i - skipped).ToString()).Value = students[i - 4, 2]; // Last Names
                    ws.Cell("E" + (i - skipped).ToString()).Value = students[i - 4, 4]; // Year Joined
                    ws.Cell("F" + (i - skipped).ToString()).Value = students[i - 4, 7]; // Grade
                    ws.Cell("G" + (i - skipped).ToString()).Value = students[i - 4, 3]; // Amount Due
                    if (students[i - 4, 3] != "$0.00")
                    {
                        owing++;
                    }
                    if (students[i - 4, 5] == "1")
                    {
                        active++;
                    }
                    Double.TryParse(students[i - 4, 3].Trim('$'), out _temp);
                    fees += _temp;
                    total++;
                }
                else
                {
                    skipped++;
                }
            }

            // Members Owing
            ws.Cell("C" + (studentLength + 4 - skipped).ToString()).Value = "Owing:";
            ws.Cell("C" + (studentLength + 4 - skipped).ToString()).Style.Font.SetBold();

            ws.Cell("D" + (studentLength + 4 - skipped).ToString()).Value = owing.ToString() + " of " + total.ToString();
            ws.Cell("D" + (studentLength + 4 - skipped).ToString()).Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;

            // Active Members
            ws.Cell("C" + (studentLength + 5 - skipped).ToString()).Value = "Active:";
            ws.Cell("C" + (studentLength + 5 - skipped).ToString()).Style.Font.SetBold();

            ws.Cell("D" + (studentLength + 5 - skipped).ToString()).Value = active.ToString() + " of " + total.ToString();
            ws.Cell("D" + (studentLength + 5 - skipped).ToString()).Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;

            // Total Fees due
            ws.Cell("F" + (studentLength + 4 - skipped).ToString()).Value = "Total:";
            ws.Cell("F" + (studentLength + 4 - skipped).ToString()).Style.Font.SetBold();

            ws.Cell("G" + (studentLength + 4 - skipped).ToString()).Value = "$" + fees.ToString();
            ws.Cell("G" + (studentLength + 4 - skipped).ToString()).Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;

            //From worksheet
            var rngTable = ws.Range("B2:G" + (studentLength + 5 - skipped).ToString());

            rngTable.FirstCell().Style
            .Font.SetBold()
            .Fill.SetBackgroundColor(cXML.XLColor.CornflowerBlue)
            .Alignment.SetHorizontal(cXML.XLAlignmentHorizontalValues.Center);

            rngTable.FirstRow().Merge();

            var num = rngTable.Range("A1:A" + (studentLength + 2 - skipped).ToString());

            num.Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;

            var due = rngTable.Range("F1:F" + (studentLength + 2 - skipped).ToString());

            due.Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;

            var rngHeaders = rngTable.Range("A2:F2"); // The address is relative to rngTable (NOT the worksheet)

            rngHeaders.Style.Alignment.Horizontal = cXML.XLAlignmentHorizontalValues.Center;
            rngHeaders.Style.Font.Bold            = true;
            rngHeaders.Style.Font.FontColor       = cXML.XLColor.DarkBlue;
            rngHeaders.Style.Fill.BackgroundColor = cXML.XLColor.Aqua;

            var rngData    = ws.Range("B3:G" + (studentLength + 5 - skipped).ToString());
            var excelTable = rngData.CreateTable();

            excelTable.ShowTotalsRow = true;

            //Add thick borders to the contents of the spreadsheet
            ws.RangeUsed().Style.Border.OutsideBorder = cXML.XLBorderStyleValues.Thick;

            ws.Columns().AdjustToContents();

            wb.SaveAs(Path.Combine(Application.StartupPath, "Report" + reportSuffix() + ".xlsx"));

            msgbox msg = new msgbox("Successfully generated report in program's local directory.", "Success", 1);

            msg.Show();
        }