Пример #1
0
        public void saveOneNoteBookCfg(KonfigurationOneNote onenoteConf)
        {
            System.IO.Directory.CreateDirectory(ExportOneNotePages.GetOutPutDir(onenoteConf.notebook));
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(ExportOneNotePages.GetOutPutDir(onenoteConf.notebook) + @"\guides.json"))
            {
                file.Write(getBookCfg(onenoteConf));

                file.Flush();
                file.Close();
            }

            Debug.WriteLine("Finished Config");
        }
Пример #2
0
 private void btnGenerateOneNotePages_Click(object sender, RoutedEventArgs e)
 {
     if (profiles.Count > 0)
     {
         string actvalue = cboProfile.SelectedValue.ToString();
         if (profiles.ContainsKey(actvalue))
         {
             if (chkRenderImages.IsChecked.HasValue)
             {
                 ExportOneNotePages.StartExportOneNotePages(actvalue, profiles[actvalue].onenoteConf);
                 MessageBox.Show("Finished btnGenerateOneNotePages_Click");
             }
         }
     }
 }
Пример #3
0
        public void readImages(KonfigurationOneNote onenoteConf)
        {
            if (onenoteConf.renderImages == false)
            {
                return;
            }

            // read images from word export file since emf conversion does not handle antialiasing
            if (images.Count == 0)
            {
                return;
            }

            string zipPath = ExportOneNotePages.GetTempDir(onenoteConf.notebook) + @"\" + this.getCfgId() + this.getCfgId() + ".docx";

            if (File.Exists(zipPath))
            {
                return;
            }
            ExportOneNotePages.oneNote.Publish(this.id, zipPath, Microsoft.Office.Interop.OneNote.PublishFormat.pfWord);
            string extractPath = ExportOneNotePages.GetTempDir(onenoteConf.notebook) + @"\" + this.getCfgId() + @"\";

            if (Directory.Exists(extractPath))
            {
                Directory.Delete(extractPath, true);
            }

            System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, extractPath);

            try
            {
                String   temp      = ExportOneNotePages.GetTempDir(onenoteConf.notebook) + @"\" + this.getCfgId() + @"\word\media\";
                String[] filePaths = Directory.GetFiles(temp);
                int      idx       = 0;
                foreach (String file in filePaths)
                {
                    if (file.StartsWith(temp + "image"))
                    {
                        File.Move(file, getPagePath(onenoteConf) + images[idx].filename);
                    }
                    idx++;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("ERROR: Saving Images from Word failed. " + ex.Message);
            }
        }
Пример #4
0
 public String getPagePath(KonfigurationOneNote onenoteConf)
 {
     return(ExportOneNotePages.GetOutPutDir(onenoteConf.notebook) + @"\" + this.getCfgId() + @"\");
 }