using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FPER { public partial class FormLogPrint : Form { public FormLogPrint() { InitializeComponent(); this.ControlPosition(); } void ControlPosition() { // form size funtion this.viewer2.Location = new Point(0, 0); this.viewer2.Width = this.Width; this.viewer2.Height = this.Height - 80; this.button1.Location = new Point(this.button1.Location.X, this.Height - 80); this.button2.Location = new Point(this.button2.Location.X, this.Height - 80); this.button3.Location = new Point(this.button3.Location.X, this.Height - 80); } public DataDynamics.ActiveReports.Document.Document Document { //set active report class set { this.viewer2.Document = value; } } private void button2_Click(object sender, EventArgs e) { // print button click this.viewer2.Document.Print(); } private void button3_Click(object sender, EventArgs e) { // save file button click this.saveFileDialog1.Filter = "(*.PDF)|*.PDF|(*.XLS)|*.XLS"; if (this.saveFileDialog1.ShowDialog() == DialogResult.OK) { bool write = true; if (this.saveFileDialog1.CheckFileExists) { if (MessageBox.Show("파일이 존재합니다. 덮어쓰겠습니까?", "", MessageBoxButtons.OKCancel) == DialogResult.OK) { write = true; } else { write = false; } } if (write) { if (this.saveFileDialog1.FileName.Substring(this.saveFileDialog1.FileName.Length - 3, 3).ToUpper() == "PDF") { this.pdfExport1.Export(this.viewer2.Document, this.saveFileDialog1.FileName); } else if (this.saveFileDialog1.FileName.Substring(this.saveFileDialog1.FileName.Length - 3, 3).ToUpper() == "XLS") { this.xlsExport1.Export(this.viewer2.Document, this.saveFileDialog1.FileName); } } } } private void button1_Click(object sender, EventArgs e) { // close preview this.Close(); } private void FormLogPrint_Resize(object sender, EventArgs e) { // resize event function this.ControlPosition(); } } }