Program.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using DocumentFormat.OpenXml.Drawing;
  2. using HTEXLib;
  3. using HTEXLib.Builders;
  4. using HTEXLib.Controller;
  5. using HTEXLib.Helpers.ShapeHelpers;
  6. using HTEXLib.Models;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Diagnostics;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Text.Json;
  14. using System.Text.RegularExpressions;
  15. namespace HTEXTest
  16. {
  17. class Program
  18. {
  19. static void Main(string[] args)
  20. {
  21. string a = "𝐿𝑀是㇀𝑁A𝑂Bcd𝑃𝑥𝑦𝑧";
  22. UTF32Encoding encoding = new UTF32Encoding();
  23. Byte[] encodedBytes = encoding.GetBytes(a);
  24. string ad = encoding.GetString(encodedBytes, 0, 4);
  25. //var a = CharHelper.chararry;
  26. // Dictionary<string, string> ditc = new Dictionary<string, string>();
  27. // foreach (var aa in a) {
  28. // int len = aa.Length;
  29. // for (int i = 1; i < len; i++) {
  30. // ditc[aa[i ]]=aa[0];
  31. // }
  32. // }
  33. //<a:schemeClr val="dk1" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" />
  34. // RgbColorModelHex rgbColorModelHex = new RgbColorModelHex(" <a:prstClr val=\"black\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" />");
  35. //string path = "F:\\PRD-20191015001-template-math.pptx";
  36. //var json = JsonSerializer.Serialize(ditc, null) ;
  37. string path = "F:\\1234o.pptx";
  38. // string path = "F:\\PRD-20191015001.pptx";
  39. var htexBuilder = new HtexBuilder();
  40. var pptSlides = htexBuilder.GetPPTSlides(path);
  41. double width = htexBuilder.getSlideWidth();
  42. double height = htexBuilder.getSlideHeight();
  43. int slideCounter = 1;
  44. Htex htex= htexBuilder.Htex;
  45. htex.page = pptSlides.Count;
  46. htex.size = new HtexSize { width = width, height = height };
  47. foreach (PPTSlide pptSlide in pptSlides)
  48. {
  49. var htexController = new HtexController( pptSlide, slideCounter, pptSlides.Count)
  50. {
  51. SlideWidth = width,
  52. SlideHeight = height
  53. };
  54. htexController.GenerateHtex();
  55. slideCounter++;
  56. }
  57. htexBuilder.presentationDocument.Close();
  58. GC.Collect();
  59. }
  60. }
  61. }