|
@@ -20,51 +20,50 @@ using Fill = TEAMModelOS.Service.Model.PowerPoint.Fill;
|
|
|
using Media = TEAMModelOS.Service.Model.PowerPoint.Media;
|
|
|
using Position = TEAMModelOS.Service.Model.PowerPoint.Position;
|
|
|
using TEAMModelOS.Service.Services.PowerPoint.Interface;
|
|
|
-using TEAMModelOS.Service.Models;
|
|
|
-using TEAMModelOS.Service.Services.Exam.Interfaces;
|
|
|
using TEAMModelOS.SDK.Helper.Common.JsonHelper;
|
|
|
+using TEAMModelOS.Service;
|
|
|
+using TEAMModelOS.SDK.DI;
|
|
|
|
|
|
namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
- public class HtexService : IHtexService
|
|
|
+ public static class HtexService
|
|
|
{
|
|
|
- private string fileShaCode { get; set; }
|
|
|
- private Dictionary<string, string> slideLayoutClrOvride { get; set; }
|
|
|
+ private static string fileShaCode { get; set; }
|
|
|
+ private static Dictionary<string, string> slideLayoutClrOvride { get; set; }
|
|
|
private const int degree = 4;
|
|
|
//private Dictionary<string, Dictionary<string, string>> styleTable = new Dictionary<string, Dictionary<string, string>>();
|
|
|
private const double px96 = 96.00, px72 = 72.00, px914400 = 914400.00, px12700 = 12700.00;
|
|
|
private const double rot60000 = 60000.00;
|
|
|
- public readonly IAzureBlobDBRepository azureBlobDBRepository;
|
|
|
- public readonly IHtmlAnalyzeService htmlAnalyzeService;
|
|
|
- public HtexService(IAzureBlobDBRepository _azureBlobDBRepository, IHtmlAnalyzeService _htmlAnalyzeService)
|
|
|
- {
|
|
|
- azureBlobDBRepository = _azureBlobDBRepository;
|
|
|
- htmlAnalyzeService = _htmlAnalyzeService;
|
|
|
- }
|
|
|
- public async Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang)
|
|
|
+ // public readonly IHtmlAnalyzeService htmlAnalyzeService;
|
|
|
+ //public HtexService(IAzureBlobDBRepository _azureBlobDBRepository)
|
|
|
+ //{
|
|
|
+ // azureBlobDBRepository = _azureBlobDBRepository;
|
|
|
+ // // htmlAnalyzeService = _htmlAnalyzeService;
|
|
|
+ //}
|
|
|
+ public static async Task<Htex> AnalyzeHtmlToHtex(this AzureStorageFactory azureBlobDBRepository, string htmlString, string Lang)
|
|
|
{
|
|
|
Htex htex = new Htex();
|
|
|
- List<Models.ItemInfo> items = htmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
|
|
|
+ List<Models.ItemInfo> items = HtmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
|
|
|
string sha= ShaHashHelper.GetSHA1(htmlString);
|
|
|
int index = 0;
|
|
|
foreach (Models.ItemInfo item in items)
|
|
|
{
|
|
|
Slide slide = new Slide { exercise = item, index = index, source = 2, flag = 2 };
|
|
|
index++;
|
|
|
- AzureBlobModel model = await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), sha, index+".json","htex",false);
|
|
|
+ AzureBlobModel model = await azureBlobDBRepository.UploadFileByContainer("hbcn",slide.ToJson(), "htex/"+sha, index+".json",false);
|
|
|
htex.slides.Add(model.BlobUrl);
|
|
|
}
|
|
|
htex.page = items.Count;
|
|
|
return htex;
|
|
|
}
|
|
|
- public async Task<Dictionary<string, object>> LoadDoc(IFormFile file)
|
|
|
+ public static async Task<Dictionary<string, object>> LoadDoc(this AzureStorageFactory azureBlobDBRepository, IFormFile file)
|
|
|
{
|
|
|
Dictionary<string, object> resdict = new Dictionary<string, object>();
|
|
|
|
|
|
if (FileType.GetExtention(file.FileName).ToLower().Equals("pptx"))
|
|
|
{
|
|
|
|
|
|
- return await ConvertPPTX(file, resdict);
|
|
|
+ return await ConvertPPTX(azureBlobDBRepository, file, resdict);
|
|
|
}
|
|
|
else if (FileType.GetExtention(file.FileName).ToLower().Equals("pdf"))
|
|
|
{
|
|
@@ -84,7 +83,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
sr.Close();
|
|
|
xmlDocument.LoadXml(builder.ToString());
|
|
|
string shaCode = fileShaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
|
|
|
- var rslt_ary = await ProcessPPTX(xmlDocument, shaCode);
|
|
|
+ var rslt_ary = await ProcessPPTX(azureBlobDBRepository, xmlDocument, shaCode);
|
|
|
//TODO
|
|
|
Dictionary<string, object> data = new Dictionary<string, object> { { "htexl", rslt_ary } };
|
|
|
return data;
|
|
@@ -95,7 +94,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async Task<Dictionary<string, object>> ConvertPPTX(IFormFile file, Dictionary<string, object> resdict)
|
|
|
+ public static async Task<Dictionary<string, object>> ConvertPPTX(this AzureStorageFactory azureBlobDBRepository, IFormFile file, Dictionary<string, object> resdict)
|
|
|
{
|
|
|
string shaCode = fileShaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
|
|
|
|
|
@@ -109,7 +108,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
|
xmlDocument.LoadXml(xdoc.ToString());
|
|
|
|
|
|
- var rslt_ary = await ProcessPPTX(xmlDocument, shaCode);
|
|
|
+ var rslt_ary = await ProcessPPTX(azureBlobDBRepository, xmlDocument, shaCode);
|
|
|
//TODO
|
|
|
Dictionary<string, object> data = new Dictionary<string, object> { { "pptx",rslt_ary} };
|
|
|
return data;
|
|
@@ -121,7 +120,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
/// <param name="xdoc"></param>
|
|
|
/// <param name="shaCode"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<Htex> ProcessPPTX(XmlDocument xdoc, string shaCode)
|
|
|
+ public static async Task<Htex> ProcessPPTX(this AzureStorageFactory azureBlobDBRepository, XmlDocument xdoc, string shaCode)
|
|
|
{
|
|
|
Htex pptx = new Htex();
|
|
|
// List<Dictionary<string, object>> post_ary = new List<Dictionary<string, object>>();
|
|
@@ -156,7 +155,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
|
|
|
slide.source = 1;
|
|
|
slide.flag = 1;
|
|
|
- AzureBlobModel model = await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), shaCode, (i + 1) + ".json", "htex", false);
|
|
|
+ AzureBlobModel model = await azureBlobDBRepository.UploadFileByContainer("hbcn",slide.ToJson(), "htex" + shaCode, (i + 1) + ".json", false);
|
|
|
pptx.slides.Add(model.BlobUrl);
|
|
|
slides.Add(slide);
|
|
|
// post_ary.Add(new Dictionary<string, object> { { "slide", slideHtml } });
|
|
@@ -185,7 +184,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
// return cssText;
|
|
|
//}
|
|
|
|
|
|
- public async Task<Slide> ProcessSingleSlide(XmlDocument xdoc, XmlNode xnode, string sldFileName, int index, dynamic slideSize, XmlNode themeContent, XmlNode tableStyles,Htex pptx)
|
|
|
+ public static async Task<Slide> ProcessSingleSlide(XmlDocument xdoc, XmlNode xnode, string sldFileName, int index, dynamic slideSize, XmlNode themeContent, XmlNode tableStyles,Htex pptx)
|
|
|
{
|
|
|
|
|
|
var resName = sldFileName.Replace("slides/slide", "slides/_rels/slide") + ".rels";
|
|
@@ -342,7 +341,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return slide;
|
|
|
}
|
|
|
|
|
|
- public async Task ProcessNodesInSlide(List<Model.PowerPoint.Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task ProcessNodesInSlide(List<Model.PowerPoint.Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
// string result = "";
|
|
|
|
|
@@ -399,7 +398,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async Task ProcessGroupSpNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task ProcessGroupSpNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
var factor = 1.00 * px96 / px914400;
|
|
|
var xfrmNode = node.GetTextByPath("p:grpSpPr/a:xfrm");
|
|
@@ -435,7 +434,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
//return result;
|
|
|
}
|
|
|
|
|
|
- public async Task ProcessGraphicFrameNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task ProcessGraphicFrameNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
// var result = "";
|
|
|
var graphicTypeUri = node.GetTextByPath("a:graphic/a:graphicData/@uri");
|
|
@@ -460,7 +459,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
//return result;
|
|
|
}
|
|
|
|
|
|
- public async Task GenDiagram(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task GenDiagram(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
var xfrmNode = node.GetTextByPath("p:xfrm");
|
|
|
var dgmRelIds = node.GetTextByPath("a:graphic/a:graphicData/dgm:relIds");
|
|
@@ -511,7 +510,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public Chart GenChart(XmlNode node,int order , WarpObj warpObj)
|
|
|
+ public static Chart GenChart(XmlNode node,int order , WarpObj warpObj)
|
|
|
{
|
|
|
Chart chart = new Chart { index=order,type= "Chart" };
|
|
|
var slideXfrmNode = node.GetTextByPath("p:xfrm");
|
|
@@ -770,7 +769,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return chart;
|
|
|
}
|
|
|
|
|
|
- public List<Dictionary<string,object>> ExtractChartData(XmlNodeList nodes) {
|
|
|
+ public static List<Dictionary<string,object>> ExtractChartData(XmlNodeList nodes) {
|
|
|
|
|
|
if (nodes != null) {
|
|
|
List<Dictionary<string, object>> listDict = new List<Dictionary<string, object>>();
|
|
@@ -841,7 +840,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public async Task<Table> GenTable(XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task<Table> GenTable(XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
Table table = new Table();
|
|
|
table.index = order;
|
|
@@ -1125,7 +1124,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
return table;
|
|
|
}
|
|
|
- private List<Border> GetTableBorders(XmlNode node, WarpObj warpObj) {
|
|
|
+ private static List<Border> GetTableBorders(XmlNode node, WarpObj warpObj) {
|
|
|
List<Border> borders = new List<Border>();
|
|
|
if (node.GetTextByPath("a:bottom") != null) {
|
|
|
string xml= "<p:spPr><a:ln>"+ node.GetTextByPath("a:bottom/a:ln").InnerXml + "</p:spPr></a:ln>";
|
|
@@ -1173,14 +1172,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return borders;
|
|
|
}
|
|
|
|
|
|
- public async Task<Model.PowerPoint.Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task<Model.PowerPoint.Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
var id = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@id");
|
|
|
var name = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@name");
|
|
|
return await GenShape("CxnSp", node, null, null, id, name, null, null, order, warpObj);
|
|
|
}
|
|
|
|
|
|
- public async Task<Model.PowerPoint.Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task<Model.PowerPoint.Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
|
|
|
/*
|
|
@@ -1222,7 +1221,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
- public async Task<Model.PowerPoint.Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
|
|
|
+ public static async Task<Model.PowerPoint.Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
|
|
|
{
|
|
|
var xfrmList = "p:spPr/a:xfrm";
|
|
|
var slideXfrmNode = node.GetTextByPath(xfrmList);
|
|
@@ -1588,7 +1587,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
|
|
|
}
|
|
|
|
|
|
- private async Task<List<Paragraph>> GenTextBody(XmlNode textBodyNode, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
+ private static async Task<List<Paragraph>> GenTextBody(XmlNode textBodyNode, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
{
|
|
|
List<Paragraph> paragraphs = new List<Paragraph>();
|
|
|
var slideMasterTextStyles = warpObj.slideMasterTextStyles;
|
|
@@ -1659,7 +1658,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return paragraphs;
|
|
|
}
|
|
|
|
|
|
- private Text GenSpanElement(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
+ private static Text GenSpanElement(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
{
|
|
|
string text;
|
|
|
var slideMasterTextStyles = warpObj.slideMasterTextStyles;
|
|
@@ -1742,7 +1741,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- private string GetTextVerticalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static string GetTextVerticalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
var baseline = node.GetTextByPath("a:rPr/@baseline");
|
|
|
if (baseline != null)
|
|
@@ -1755,7 +1754,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string GetTextHorizontalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static string GetTextHorizontalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
var getAlgn = node.GetTextByPath("a:pPr/@algn");
|
|
|
var align = "initial";
|
|
@@ -1786,7 +1785,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return align;
|
|
|
}
|
|
|
|
|
|
- private string GetFontDecoration(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static string GetFontDecoration(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
if (node.GetTextByPath("a:rPr") != null)
|
|
|
{
|
|
@@ -1817,7 +1816,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string GetFontItalic(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static string GetFontItalic(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
var FontBold = node.GetTextByPath("a:rPr/@i");
|
|
|
if (FontBold != null)
|
|
@@ -1837,7 +1836,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string GetFontBold(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static string GetFontBold(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
var FontBold = node.GetTextByPath("a:rPr/@b");
|
|
|
if (FontBold != null)
|
|
@@ -1857,7 +1856,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string GetFontType(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles, XmlNode themeContent)
|
|
|
+ private static string GetFontType(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles, XmlNode themeContent)
|
|
|
{
|
|
|
string typeface = "inherit";
|
|
|
XmlNode typefaceNode = node.GetTextByPath("a:rPr/a:latin/@typeface");
|
|
@@ -1885,7 +1884,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return typeface;
|
|
|
}
|
|
|
|
|
|
- private async Task<BuChar> GenBuChar(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
+ private static async Task<BuChar> GenBuChar(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
|
|
|
{
|
|
|
var sldMstrTxtStyles = warpObj.slideMasterTextStyles;
|
|
|
var slideMasterContent = warpObj.slideMasterContent;
|
|
@@ -2215,7 +2214,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return BuChar;
|
|
|
}
|
|
|
|
|
|
- private double GetFontSize(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
+ private static double GetFontSize(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
double fontSize = 0;
|
|
|
if (node.GetTextByPath("a:rPr/@sz") != null)
|
|
@@ -2267,7 +2266,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return fontSize;
|
|
|
}
|
|
|
|
|
|
- private dynamic GetFontColorPr(XmlNode node, XmlNode spNode, XmlNode type, XmlNode sldMstrTxtStyles, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
+ private static dynamic GetFontColorPr(XmlNode node, XmlNode spNode, XmlNode type, XmlNode sldMstrTxtStyles, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
{
|
|
|
var rPrNode = node.GetTextByPath("a:rPr");
|
|
|
string filTyp, textBordr;
|
|
@@ -2328,7 +2327,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
return new { color, textBordr };
|
|
|
}
|
|
|
- public string GetVerticalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
|
|
|
+ public static string GetVerticalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
|
|
|
{
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
doc.LoadXml(node.OuterXml);
|
|
@@ -2356,7 +2355,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public string GetWritingMode(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
|
|
|
+ public static string GetWritingMode(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
|
|
|
{
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
doc.LoadXml(node.OuterXml);
|
|
@@ -2384,7 +2383,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public string GetHorizontalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode,
|
|
|
+ public static string GetHorizontalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode,
|
|
|
XmlNode typeNode, XmlNode slideMasterTextStyles)
|
|
|
{
|
|
|
XmlDocument doc = new XmlDocument();
|
|
@@ -2452,7 +2451,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
/// <param name="index"></param>
|
|
|
/// <param name="warpObj"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<Fill> GetSlideBackgroundFill(XmlNode slideContent, int index, WarpObj warpObj)
|
|
|
+ public static async Task<Fill> GetSlideBackgroundFill(XmlNode slideContent, int index, WarpObj warpObj)
|
|
|
{
|
|
|
var bgPr = slideContent.GetTextByPath("pkg:xmlData/p:sld/p:cSld/p:bg/p:bgPr");
|
|
|
var bgRef = slideContent.GetTextByPath("pkg:xmlData/p:sld/p:cSld/p:bg/p:bgRef");
|
|
@@ -2727,7 +2726,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
|
|
|
|
|
|
|
|
|
- public async Task<Fill> GetPicFill(string type, XmlNode node, WarpObj warpObj)
|
|
|
+ public static async Task<Fill> GetPicFill(string type, XmlNode node, WarpObj warpObj)
|
|
|
{
|
|
|
|
|
|
//Need to test/////////////////////////////////////////////
|
|
@@ -2804,7 +2803,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
|
|
|
|
|
|
- public async Task<Fill> GetShapeFill(XmlNode node, WarpObj warpObj)
|
|
|
+ public static async Task<Fill> GetShapeFill(XmlNode node, WarpObj warpObj)
|
|
|
{
|
|
|
|
|
|
// 1. presentationML
|
|
@@ -2964,7 +2963,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
|
|
|
|
|
|
- public async Task<AzureBlobModel> GetThumbnailModel(XmlDocument xdoc, string shaCode)
|
|
|
+ public static async Task<AzureBlobModel> GetThumbnailModel(XmlDocument xdoc, string shaCode)
|
|
|
{
|
|
|
var thumbnailNode = xdoc.GetTextByPath("//pkg:part[@pkg:name='/docProps/thumbnail.jpeg']");
|
|
|
if (thumbnailNode != null)
|
|
@@ -2976,14 +2975,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public XmlNode LoadTheme(XmlDocument xdoc)
|
|
|
+ public static XmlNode LoadTheme(XmlDocument xdoc)
|
|
|
{
|
|
|
var themeRelationship = xdoc.GetTextByPath("//pkg:part[@pkg:name='/ppt/_rels/presentation.xml.rels']/pkg:xmlData/rel:Relationships/rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme']/@Target");
|
|
|
// "/ppt/theme/theme1.xml"
|
|
|
string themeURI = "/ppt/" + themeRelationship.Value;
|
|
|
return xdoc.GetTextByPath("//pkg:part[@pkg:name='" + themeURI + "']");
|
|
|
}
|
|
|
- public async Task<AzureBlobModel> SaveBase64ToBolob(string data, string contentType, string FolderName, string fileName)
|
|
|
+ public static async Task<AzureBlobModel> SaveBase64ToBolob(string data, string contentType, string FolderName, string fileName)
|
|
|
{
|
|
|
string fileExt;
|
|
|
if (ContentTypeDict.extdict.TryGetValue(contentType, out string ext))
|
|
@@ -3013,13 +3012,16 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
fileName += fileExt;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ string url = "data:"+contentType+";base64,"+data;
|
|
|
Stream streamBlob = new MemoryStream(Convert.FromBase64String(data));
|
|
|
- AzureBlobModel model = await azureBlobDBRepository.UploadFileByFolder(streamBlob, FolderName, fileName, "pptx", false);
|
|
|
+ // AzureBlobModel model = await azureBlobDBRepository.UploadFileByFolder(streamBlob, FolderName, fileName, "pptx", false);
|
|
|
+ AzureBlobModel model =new AzureBlobModel { BlobUrl= url };
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public async Task<Media> ProcessPicNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
+ public static async Task<Media> ProcessPicNode(XmlNode node, int order, WarpObj warpObj)
|
|
|
{
|
|
|
var xfrmList = "p:spPr/a:xfrm";
|
|
|
var xfrmNode = node.GetTextByPath(xfrmList);
|