|
@@ -20,10 +20,13 @@ 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.Evaluation.Models;
|
|
|
+using TEAMModelOS.Service.Services.Evaluation.Interfaces;
|
|
|
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
|
|
|
|
|
|
namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
- public class PowerPointService : IPowerPointService
|
|
|
+ public class HtexService : IHtexService
|
|
|
{
|
|
|
private string fileShaCode { get; set; }
|
|
|
private Dictionary<string, string> slideLayoutClrOvride { get; set; }
|
|
@@ -32,13 +35,29 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
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 PowerPointService(IAzureBlobDBRepository _azureBlobDBRepository)
|
|
|
+ public readonly IHtmlAnalyzeService htmlAnalyzeService;
|
|
|
+ public HtexService(IAzureBlobDBRepository _azureBlobDBRepository, IHtmlAnalyzeService _htmlAnalyzeService)
|
|
|
{
|
|
|
azureBlobDBRepository = _azureBlobDBRepository;
|
|
|
+ htmlAnalyzeService = _htmlAnalyzeService;
|
|
|
}
|
|
|
-
|
|
|
- public async Task<Dictionary<string, object>> LoadPresentation(IFormFile file)
|
|
|
+ public async Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang)
|
|
|
+ {
|
|
|
+ Htex htex = new Htex();
|
|
|
+ List<ItemInfo> items = htmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
|
|
|
+ string sha= ShaHashHelper.GetSHA1(htmlString);
|
|
|
+ int index = 0;
|
|
|
+ foreach (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);
|
|
|
+ htex.Slides.Add(model.BlobUrl);
|
|
|
+ }
|
|
|
+ htex.Page = items.Count;
|
|
|
+ return htex;
|
|
|
+ }
|
|
|
+ public async Task<Dictionary<string, object>> LoadDoc(IFormFile file)
|
|
|
{
|
|
|
Dictionary<string, object> resdict = new Dictionary<string, object>();
|
|
|
|
|
@@ -132,14 +151,17 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
string filename = node.GetTextByPath("@pkg:name").Value;
|
|
|
//处理当前页的幻灯片
|
|
|
Slide slide = await ProcessSingleSlide(xdoc, node, filename, i, slideSize, themeContent, tableStyles, pptx);
|
|
|
+
|
|
|
+ slide.Source = 1;
|
|
|
+ slide.Flag = 1;
|
|
|
+ AzureBlobModel model = await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), shaCode, (i + 1) + ".json", "htex", false);
|
|
|
+ pptx.Slides.Add(model.BlobUrl);
|
|
|
slides.Add(slide);
|
|
|
- // post_ary.Add(new Dictionary<string, object> { { "slide", slideHtml } });
|
|
|
- // post_ary.Add(new Dictionary<string, object> { { "progress-update", (i + 1) * 100 / numOfSlides } });
|
|
|
+ // post_ary.Add(new Dictionary<string, object> { { "slide", slideHtml } });
|
|
|
+ // post_ary.Add(new Dictionary<string, object> { { "progress-update", (i + 1) * 100 / numOfSlides } });
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- pptx.Slides = slides;
|
|
|
- pptx.Sha1Code = shaCode;
|
|
|
+ // pptx.Sha1Code = shaCode;
|
|
|
pptx.Page = slides.Count;
|
|
|
//post_ary.Add( "slide", slides );
|
|
|
//post_ary.Add( "globalCSS", GenGlobalCSS() );
|