コード例 #1
0
ファイル: Word.cs プロジェクト: mrbm2007/stopwatch
        public WordEditor(string fileName)
        {
            this.FileName = fileName;
            while (ExcelEditor.IsFileLocked(FileName))
            {
                Form_msg.Show(null, "فایل باز است:" + "\r\n" + FileName + "\r\n" + "لطفا آن را ببندید");
            }

            dir = Path.GetTempPath() + "\\stp-" + Path.GetFileNameWithoutExtension(FileName) + "\\";
            Zip.UnZipFiles(FileName, dir, deleteZipFile: false);
            Content = File.ReadAllText(dir + "word\\document.xml");
        }
コード例 #2
0
        public ExcelGenerator(string FileName, int sheet = 1, bool refresh_data = false)
        {
            this.FileName = FileName;
            int rrr = 10;

            while (File.Exists(FileName) && IsFileLocked(FileName) && rrr-- > 0)
            {
                if (Form_msg.Show(null,
                                  "فایل باز است:" + "\r\n" + FileName + "\r\n" + "لطفا آن را ببندید",
                                  "StopWatch", btn: MessageBoxButtons.YesNo, yesCaption: "ادامه", noCaption: "توقف") == DialogResult.No)
                {
                    HasError = true;
                    return;
                }
            }
            if (refresh_data)
            {
                RefreshData();
            }
            dir = Path.GetTempPath() + "\\stp-" + Path.GetFileNameWithoutExtension(FileName) + "\\";
            Zip.UnZipFiles(FileName, dir, deleteZipFile: false);
            CurrentSheet = sheet;
        }