|
@@ -11,6 +11,7 @@ using HTEXLib.Models;
|
|
|
using ColorType = DocumentFormat.OpenXml.Drawing.ColorType;
|
|
|
using System.Linq;
|
|
|
using DocumentFormat.OpenXml.Packaging;
|
|
|
+using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
|
|
|
namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
{
|
|
@@ -64,6 +65,116 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
string FontColor = FontReferenceColors(shapeStyle.FontReference, slide);
|
|
|
return new SlideColor { LineColor = LineColor, FillColor = FillColor, EffectColor = EffectColor, FontColor = FontColor };
|
|
|
}
|
|
|
+ public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(DocumentFormat.OpenXml.Drawing.Charts.ShapeProperties shapeProperties, PPTSlide slide, string type, string partForm)
|
|
|
+ {
|
|
|
+ //Outline
|
|
|
+ var lnNode = shapeProperties.GetFirstChild<Outline>();
|
|
|
+ Border border = null;
|
|
|
+ if (lnNode != null)
|
|
|
+ {
|
|
|
+ border = DoOutline(lnNode, slide, type);
|
|
|
+ }
|
|
|
+ Fill fill = new Fill() { type = -1 };
|
|
|
+ var gradFill = shapeProperties.GetFirstChild<GradientFill>();
|
|
|
+ if (gradFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 2;
|
|
|
+ fill.gradientFill = DoGradientFill(gradFill, slide);
|
|
|
+ }
|
|
|
+ var noFill = shapeProperties.GetFirstChild<NoFill>();
|
|
|
+ if (noFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 0;
|
|
|
+ }
|
|
|
+ var pattFill = shapeProperties.GetFirstChild<PatternFill>();
|
|
|
+ if (pattFill != null)
|
|
|
+ {
|
|
|
+ HtexPattFill htexPattFill = DoPattFill(pattFill, slide);
|
|
|
+ fill.type = 4;
|
|
|
+ fill.pattFill = htexPattFill;
|
|
|
+ }
|
|
|
+ var solidFill = shapeProperties.GetFirstChild<SolidFill>();
|
|
|
+ if (solidFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 1;
|
|
|
+ fill.solidFill = DoSolidFill(solidFill, slide);
|
|
|
+ }
|
|
|
+ var groupFill = shapeProperties.GetFirstChild<GroupFill>();
|
|
|
+ if (groupFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 5;
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ var blipFill = shapeProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.BlipFill>();
|
|
|
+ if (blipFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 3;
|
|
|
+ fill.blipFill = DoBlipFill(blipFill, slide, partForm);
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ var EffectList = shapeProperties.GetFirstChild<EffectList>();
|
|
|
+ var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
|
|
|
+ var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
|
|
|
+ var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
|
|
|
+ var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
|
|
|
+ // CustomGeometry PresetGeometry TODO
|
|
|
+ return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
|
|
|
+ }
|
|
|
+ public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(ChartShapeProperties shapeProperties, PPTSlide slide, string type, string partForm)
|
|
|
+ {
|
|
|
+ //Outline
|
|
|
+ var lnNode = shapeProperties.GetFirstChild<Outline>();
|
|
|
+ Border border = null;
|
|
|
+ if (lnNode != null)
|
|
|
+ {
|
|
|
+ border = DoOutline(lnNode, slide, type);
|
|
|
+ }
|
|
|
+ Fill fill = new Fill() { type = -1 };
|
|
|
+ var gradFill = shapeProperties.GetFirstChild<GradientFill>();
|
|
|
+ if (gradFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 2;
|
|
|
+ fill.gradientFill = DoGradientFill(gradFill, slide);
|
|
|
+ }
|
|
|
+ var noFill = shapeProperties.GetFirstChild<NoFill>();
|
|
|
+ if (noFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 0;
|
|
|
+ }
|
|
|
+ var pattFill = shapeProperties.GetFirstChild<PatternFill>();
|
|
|
+ if (pattFill != null)
|
|
|
+ {
|
|
|
+ HtexPattFill htexPattFill = DoPattFill(pattFill, slide);
|
|
|
+ fill.type = 4;
|
|
|
+ fill.pattFill = htexPattFill;
|
|
|
+ }
|
|
|
+ var solidFill = shapeProperties.GetFirstChild<SolidFill>();
|
|
|
+ if (solidFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 1;
|
|
|
+ fill.solidFill = DoSolidFill(solidFill, slide);
|
|
|
+ }
|
|
|
+ var groupFill = shapeProperties.GetFirstChild<GroupFill>();
|
|
|
+ if (groupFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 5;
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ var blipFill = shapeProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.BlipFill>();
|
|
|
+ if (blipFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 3;
|
|
|
+ fill.blipFill = DoBlipFill(blipFill, slide, partForm);
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ var EffectList = shapeProperties.GetFirstChild<EffectList>();
|
|
|
+ var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
|
|
|
+ var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
|
|
|
+ var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
|
|
|
+ var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
|
|
|
+ // CustomGeometry PresetGeometry TODO
|
|
|
+ return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
|
|
|
+ }
|
|
|
public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(GroupShapeProperties shapeProperties, PPTSlide slide, string type, string partForm)
|
|
|
{
|
|
|
//Outline
|
|
@@ -118,7 +229,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
|
|
|
return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
|
|
|
}
|
|
|
- public static HTEXLib.Models.HTEX.ShapeStyle DoTableProperties(TableProperties shapeProperties, PPTSlide slide, string type, string partForm)
|
|
|
+ public static TbStyle DoTableProperties(TableProperties shapeProperties, PPTSlide slide, string type, string partForm)
|
|
|
{
|
|
|
Fill fill = new Fill() { type = -1 };
|
|
|
var gradFill = shapeProperties.GetFirstChild<GradientFill>();
|
|
@@ -158,97 +269,178 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
fill.blipFill = DoBlipFill(blipFill, slide, partForm);
|
|
|
// fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
}
|
|
|
+ var TableStyleId = shapeProperties.GetFirstChild<TableStyleId>().InnerText;
|
|
|
+ TableStyleType TableStyle = shapeProperties.GetFirstChild<TableStyle>();
|
|
|
+ if (TableStyle == null)
|
|
|
+ {
|
|
|
+ var TableStyleEntrys = slide.tableStylesPart.TableStyleList.Elements<TableStyleEntry>();
|
|
|
+ foreach (var TableStyleEntry in TableStyleEntrys) {
|
|
|
+ if (TableStyleEntry.StyleId == TableStyleId) {
|
|
|
+ TableStyle = TableStyleEntry;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TbStyle tbStyle =DoTableStyle(TableStyle,slide,type,partForm);
|
|
|
+ if (fill != null && fill.type == -1)
|
|
|
+ {
|
|
|
+ tbStyle.fill = fill;
|
|
|
+ }
|
|
|
+ //TODO
|
|
|
var EffectList = shapeProperties.GetFirstChild<EffectList>();
|
|
|
var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
|
|
|
- var TableStyle = shapeProperties.GetFirstChild<TableStyle>();
|
|
|
-
|
|
|
- var TableStyleId = shapeProperties.GetFirstChild<TableStyleId>();
|
|
|
var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.ExtensionList>();
|
|
|
-
|
|
|
- return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill};
|
|
|
+ tbStyle.RightToLeft = shapeProperties.RightToLeft != null? shapeProperties.RightToLeft.Value:false;
|
|
|
+ tbStyle.FirstRow = shapeProperties.FirstRow != null ? shapeProperties.FirstRow.Value : false;
|
|
|
+ tbStyle.FirstColumn = shapeProperties.FirstColumn != null ? shapeProperties.FirstColumn.Value : false;
|
|
|
+ tbStyle.LastRow = shapeProperties.LastRow != null ? shapeProperties.LastRow.Value : false;
|
|
|
+ tbStyle.LastColumn = shapeProperties.LastColumn != null ? shapeProperties.LastColumn.Value : false;
|
|
|
+ tbStyle.BandRow = shapeProperties.BandRow != null ? shapeProperties.BandRow.Value : false;
|
|
|
+ tbStyle.BandColumn = shapeProperties.BandColumn != null ? shapeProperties.BandColumn.Value : false;
|
|
|
+ return tbStyle;
|
|
|
}
|
|
|
|
|
|
- public static void DoTableStyle(TableStyle tableStyle, PPTSlide slide, string type, string partForm) {
|
|
|
+ public static TbStyle DoTableStyle(TableStyleType tableStyle, PPTSlide slide, string type, string partForm) {
|
|
|
+ TbStyle tbStyle = new TbStyle();
|
|
|
+ if (tableStyle == null) {
|
|
|
+ return tbStyle;
|
|
|
+ }
|
|
|
var TableBackground = tableStyle.TableBackground;
|
|
|
if (TableBackground != null)
|
|
|
{
|
|
|
var shapeProperties = TableBackground.GetFirstChild<FillProperties>();
|
|
|
Fill fill = DoFillProperties(shapeProperties , partForm,slide );
|
|
|
var FillReference = TableBackground.GetFirstChild<FillReference>();
|
|
|
- DoFillReference(slide, fill, FillReference);
|
|
|
+ fill= DoFillReference(slide, fill, FillReference);
|
|
|
+ tbStyle.fill = fill;
|
|
|
//TODO
|
|
|
TableBackground.GetFirstChild<EffectPropertiesType>();
|
|
|
TableBackground.GetFirstChild<EffectReference>();
|
|
|
}
|
|
|
//TablePartStyleType
|
|
|
+
|
|
|
+ List<CellStyle> cellStyles = new List<CellStyle>();
|
|
|
+
|
|
|
var WholeTable = tableStyle.WholeTable;
|
|
|
if (WholeTable != null) {
|
|
|
- DoTablePartStyleType(WholeTable, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(WholeTable, slide, type, partForm);
|
|
|
+ if (style != null) {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var Band1Horizontal = tableStyle.Band1Horizontal;
|
|
|
if (Band1Horizontal != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(Band1Horizontal, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(Band1Horizontal, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var Band2Horizontal = tableStyle.Band2Horizontal;
|
|
|
if (Band2Horizontal != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(Band2Horizontal, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(Band2Horizontal, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var Band1Vertical = tableStyle.Band1Vertical;
|
|
|
if (Band1Vertical != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(Band1Vertical, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(Band1Vertical, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var Band2Vertical = tableStyle.Band2Vertical;
|
|
|
if (Band2Vertical != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(Band2Vertical, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(Band2Vertical, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var LastColumn = tableStyle.LastColumn;
|
|
|
if (LastColumn != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(LastColumn, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(LastColumn, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var FirstColumn = tableStyle.FirstColumn;
|
|
|
if (FirstColumn != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(FirstColumn, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(FirstColumn, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var FirstRow = tableStyle.FirstRow;
|
|
|
if (FirstRow != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(FirstRow, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(FirstRow, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var LastRow = tableStyle.LastRow;
|
|
|
if (LastRow != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(LastRow, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(LastRow, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var SoutheastCell = tableStyle.SoutheastCell;
|
|
|
if (SoutheastCell != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(SoutheastCell, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(SoutheastCell, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var SouthwestCell = tableStyle.SouthwestCell;
|
|
|
if (SouthwestCell != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(SouthwestCell, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(SouthwestCell, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var NortheastCell = tableStyle.NortheastCell;
|
|
|
if (NortheastCell != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(NortheastCell, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(NortheastCell, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
var NorthwestCell = tableStyle.NorthwestCell;
|
|
|
if (NorthwestCell != null)
|
|
|
{
|
|
|
- DoTablePartStyleType(NorthwestCell, slide, type, partForm);
|
|
|
+ var style= DoTablePartStyleType(NorthwestCell, slide, type, partForm);
|
|
|
+ if (style != null)
|
|
|
+ {
|
|
|
+ cellStyles.Add(style);
|
|
|
+ }
|
|
|
}
|
|
|
+ tbStyle.cellStyles = cellStyles;
|
|
|
var ExtensionList = tableStyle.ExtensionList;
|
|
|
+ return tbStyle;
|
|
|
}
|
|
|
|
|
|
- private static void DoFillReference(PPTSlide slide, Fill fill, FillReference FillReference)
|
|
|
+ private static Fill DoFillReference(PPTSlide slide, Fill fill, FillReference FillReference)
|
|
|
{
|
|
|
if (FillReference != null)
|
|
|
{
|
|
@@ -283,6 +475,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
fill.type = 2;
|
|
|
}
|
|
|
}
|
|
|
+ return fill;
|
|
|
}
|
|
|
|
|
|
private static Fill DoFillProperties(FillProperties shapeProperties , string partForm, PPTSlide slide)
|
|
@@ -333,8 +526,16 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
return fill;
|
|
|
}
|
|
|
|
|
|
- public static void DoTablePartStyleType(TablePartStyleType tablePartStyleType, PPTSlide slide, string type, string partForm) {
|
|
|
+ /// <summary>
|
|
|
+ /// 单元格样式表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="tablePartStyleType"></param>
|
|
|
+ /// <param name="slide"></param>
|
|
|
+ /// <param name="type"></param>
|
|
|
+ /// <param name="partForm"></param>
|
|
|
+ public static CellStyle DoTablePartStyleType(TablePartStyleType tablePartStyleType, PPTSlide slide, string type, string partForm) {
|
|
|
//表格单元格文本样式。
|
|
|
+ CellStyle cellStyle = new CellStyle() { type= tablePartStyleType.GetType().Name};
|
|
|
var TableCellTextStyle = tablePartStyleType.GetFirstChild<TableCellTextStyle>();
|
|
|
if (TableCellTextStyle != null) {
|
|
|
FontStyle fontStyle = new FontStyle { };
|
|
@@ -420,120 +621,226 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
}
|
|
|
//字体属性
|
|
|
var font = TableCellTextStyle.GetFirstChild<DocumentFormat.OpenXml.Drawing.Fonts>();
|
|
|
- var LatinFont= font.LatinFont;
|
|
|
- var EastAsianFont= font.EastAsianFont;
|
|
|
- var ComplexScriptFont= font.ComplexScriptFont;
|
|
|
- if (EastAsianFont != null)
|
|
|
- {
|
|
|
- fontStyle.family= DoTextFontType(EastAsianFont,slide);
|
|
|
- }
|
|
|
- if (ComplexScriptFont != null)
|
|
|
- {
|
|
|
- fontStyle.family = DoTextFontType(ComplexScriptFont, slide);
|
|
|
- }
|
|
|
- if (LatinFont != null)
|
|
|
- {
|
|
|
- fontStyle.family = DoTextFontType(LatinFont, slide);
|
|
|
- }
|
|
|
- var SupplementalFont= font.GetFirstChild<SupplementalFont>();
|
|
|
- if (SupplementalFont != null) {
|
|
|
- fontStyle.family = SupplementalFont.Typeface;
|
|
|
+ if (font != null) {
|
|
|
+ var LatinFont = font.LatinFont;
|
|
|
+ var EastAsianFont = font.EastAsianFont;
|
|
|
+ var ComplexScriptFont = font.ComplexScriptFont;
|
|
|
+ if (EastAsianFont != null)
|
|
|
+ {
|
|
|
+ fontStyle.family = DoTextFontType(EastAsianFont, slide);
|
|
|
+ }
|
|
|
+ if (ComplexScriptFont != null)
|
|
|
+ {
|
|
|
+ fontStyle.family = DoTextFontType(ComplexScriptFont, slide);
|
|
|
+ }
|
|
|
+ if (LatinFont != null)
|
|
|
+ {
|
|
|
+ fontStyle.family = DoTextFontType(LatinFont, slide);
|
|
|
+ }
|
|
|
+ var SupplementalFont = font.GetFirstChild<SupplementalFont>();
|
|
|
+ if (SupplementalFont != null)
|
|
|
+ {
|
|
|
+ fontStyle.family = SupplementalFont.Typeface;
|
|
|
+ }
|
|
|
+ cellStyle.fontStyle = fontStyle;
|
|
|
}
|
|
|
}
|
|
|
//表格单元格样式。
|
|
|
var TableCellStyle = tablePartStyleType.GetFirstChild<TableCellStyle>();
|
|
|
if (TableCellStyle != null)
|
|
|
{
|
|
|
+ List<CellBorder> cellBorders = new List<CellBorder>();
|
|
|
var TableCellBorders= TableCellStyle.TableCellBorders;
|
|
|
if (TableCellBorders != null) {
|
|
|
var LeftBorder = TableCellBorders.LeftBorder;
|
|
|
if (LeftBorder != null) {
|
|
|
- Border border= DoOutline(LeftBorder.Outline, slide, "tbl");
|
|
|
+ Border border= DoOutline(LeftBorder.Outline, slide, type);
|
|
|
if (LeftBorder.LineReference!=null&& border.color.type == -1) {
|
|
|
border.color.solidFill=DoMatrixReferenceColors(LeftBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Left" });
|
|
|
}
|
|
|
var RightBorder = TableCellBorders.RightBorder;
|
|
|
if (RightBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(RightBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(RightBorder.Outline, slide, type);
|
|
|
if (RightBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(RightBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Right" });
|
|
|
}
|
|
|
var TopBorder = TableCellBorders.TopBorder;
|
|
|
if (TopBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(TopBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(TopBorder.Outline, slide, type);
|
|
|
if (TopBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(TopBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Top" });
|
|
|
}
|
|
|
var BottomBorder = TableCellBorders.BottomBorder;
|
|
|
if (BottomBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(BottomBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(BottomBorder.Outline, slide, type);
|
|
|
if (BottomBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(BottomBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Bottom" });
|
|
|
}
|
|
|
var InsideHorizontalBorder = TableCellBorders.InsideHorizontalBorder;
|
|
|
if (InsideHorizontalBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(InsideHorizontalBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(InsideHorizontalBorder.Outline, slide, type);
|
|
|
if (InsideHorizontalBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(InsideHorizontalBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "InHor" });
|
|
|
}
|
|
|
var InsideVerticalBorder = TableCellBorders.InsideVerticalBorder;
|
|
|
if (InsideVerticalBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(InsideVerticalBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(InsideVerticalBorder.Outline, slide, type);
|
|
|
if (InsideVerticalBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(InsideVerticalBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "InVer" });
|
|
|
}
|
|
|
var TopLeftToBottomRightBorder = TableCellBorders.TopLeftToBottomRightBorder;
|
|
|
if (TopLeftToBottomRightBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(TopLeftToBottomRightBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(TopLeftToBottomRightBorder.Outline, slide, type);
|
|
|
if (TopLeftToBottomRightBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(TopLeftToBottomRightBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Tl2br" });
|
|
|
}
|
|
|
var TopRightToBottomLeftBorder = TableCellBorders.TopRightToBottomLeftBorder;
|
|
|
if (TopRightToBottomLeftBorder != null)
|
|
|
{
|
|
|
- Border border = DoOutline(TopRightToBottomLeftBorder.Outline, slide, "tbl");
|
|
|
+ Border border = DoOutline(TopRightToBottomLeftBorder.Outline, slide, type);
|
|
|
if (TopRightToBottomLeftBorder.LineReference != null && border.color.type == -1)
|
|
|
{
|
|
|
border.color.solidFill = DoMatrixReferenceColors(TopRightToBottomLeftBorder.LineReference, slide);
|
|
|
border.color.type = 2;
|
|
|
}
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Tr2bl" });
|
|
|
}
|
|
|
}
|
|
|
+ cellStyle.cellBorders = cellBorders;
|
|
|
var FillProperties = TableCellStyle.GetFirstChild<FillProperties>();
|
|
|
Fill fill = DoFillProperties(FillProperties, partForm, slide);
|
|
|
var FillReference = TableCellStyle.GetFirstChild<FillReference>();
|
|
|
- DoFillReference(slide, fill, FillReference);
|
|
|
+ fill= DoFillReference(slide, fill, FillReference);
|
|
|
+ cellStyle.fill = fill;
|
|
|
//TODO
|
|
|
var Cell3DProperties = TableCellStyle.GetFirstChild<Cell3DProperties>();
|
|
|
+ }
|
|
|
+ return cellStyle;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static CellStyle DoTableCellProperties(TableCellProperties shapeProperties, PPTSlide slide ,string type ,string partForm) {
|
|
|
+ CellStyle cellStyle = new CellStyle();
|
|
|
+
|
|
|
+ //TODO
|
|
|
+ var Cell3DProperties = shapeProperties.GetFirstChild<Cell3DProperties>();
|
|
|
+ Fill fill = new Fill() { type = -1 };
|
|
|
+ var gradFill = shapeProperties.GetFirstChild<GradientFill>();
|
|
|
+ if (gradFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 2;
|
|
|
+ fill.gradientFill = DoGradientFill(gradFill, slide);
|
|
|
+ }
|
|
|
+ var noFill = shapeProperties.GetFirstChild<NoFill>();
|
|
|
+ if (noFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 0;
|
|
|
+ }
|
|
|
+ var pattFill = shapeProperties.GetFirstChild<PatternFill>();
|
|
|
+ if (pattFill != null)
|
|
|
+ {
|
|
|
+ HtexPattFill htexPattFill = DoPattFill(pattFill, slide);
|
|
|
+ fill.type = 4;
|
|
|
+ fill.pattFill = htexPattFill;
|
|
|
+ }
|
|
|
+ var solidFill = shapeProperties.GetFirstChild<SolidFill>();
|
|
|
+ if (solidFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 1;
|
|
|
+ fill.solidFill = DoSolidFill(solidFill, slide);
|
|
|
+ }
|
|
|
+ var groupFill = shapeProperties.GetFirstChild<GroupFill>();
|
|
|
+ if (groupFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 5;
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ var blipFill = shapeProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.BlipFill>();
|
|
|
+ if (blipFill != null)
|
|
|
+ {
|
|
|
+ fill.type = 3;
|
|
|
+ fill.blipFill = DoBlipFill(blipFill, slide, partForm);
|
|
|
+ // fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
|
|
|
+ }
|
|
|
+ cellStyle.fill = fill;
|
|
|
+ List<CellBorder> cellBorders = new List<CellBorder>();
|
|
|
+ var LeftBorder = shapeProperties.LeftBorderLineProperties;
|
|
|
+ if (LeftBorder != null)
|
|
|
+ {
|
|
|
+ Border border = DoOutline(LeftBorder, slide, type);
|
|
|
+
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Left" });
|
|
|
+ }
|
|
|
+ var RightBorder = shapeProperties.RightBorderLineProperties;
|
|
|
+ if (RightBorder != null)
|
|
|
+ {
|
|
|
+ Border border = DoOutline(RightBorder, slide, type);
|
|
|
+
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Right" });
|
|
|
+ }
|
|
|
+ var TopBorderLineProperties = shapeProperties.TopBorderLineProperties;
|
|
|
+ if (TopBorderLineProperties != null)
|
|
|
+ {
|
|
|
+ Border border = DoOutline(TopBorderLineProperties, slide, type);
|
|
|
+
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Top" });
|
|
|
+ }
|
|
|
+ var BottomBorderLineProperties = shapeProperties.BottomBorderLineProperties;
|
|
|
+ if (BottomBorderLineProperties != null)
|
|
|
+ {
|
|
|
+ Border border = DoOutline(BottomBorderLineProperties, slide, type);
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Bottom" });
|
|
|
+ }
|
|
|
|
|
|
+ var TopLeftToBottomRightBorderLineProperties = shapeProperties.TopLeftToBottomRightBorderLineProperties;
|
|
|
+ if (TopLeftToBottomRightBorderLineProperties != null)
|
|
|
+ {
|
|
|
+ // \
|
|
|
+ Border border = DoOutline(TopLeftToBottomRightBorderLineProperties, slide, type);
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Tl2br" });
|
|
|
}
|
|
|
+ var BottomLeftToTopRightBorderLineProperties = shapeProperties.BottomLeftToTopRightBorderLineProperties;
|
|
|
+ if (BottomLeftToTopRightBorderLineProperties != null)
|
|
|
+ { // /
|
|
|
+ Border border = DoOutline(BottomLeftToTopRightBorderLineProperties, slide, type);
|
|
|
+ cellBorders.Add(new CellBorder() { border = border, type = "Tr2bl" });
|
|
|
+ }
|
|
|
+ cellStyle.cellBorders = cellBorders;
|
|
|
+ return cellStyle;
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
@@ -596,6 +903,9 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
{
|
|
|
|
|
|
Fill fill = new Fill() { type = -1 };
|
|
|
+ if (shapeProperties == null) {
|
|
|
+ return fill;
|
|
|
+ }
|
|
|
var gradFill = shapeProperties.GetFirstChild<GradientFill>();
|
|
|
if (gradFill != null)
|
|
|
{
|
|
@@ -782,7 +1092,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
/// </summary>
|
|
|
/// <param name="shapeProperties"></param>
|
|
|
/// <param name="slide"></param>
|
|
|
- public static Border DoOutline(DocumentFormat.OpenXml.Drawing.Outline outline, PPTSlide slide,string Shapetype) {
|
|
|
+ public static Border DoOutline(DocumentFormat.OpenXml.Drawing.LinePropertiesType outline, PPTSlide slide,string Shapetype) {
|
|
|
Border border = new Border() {color= new Fill { type=-1} };
|
|
|
//20.1.10.35 EMUs. 1 pt = 12700 EMUs.
|
|
|
double? Width = null;
|
|
@@ -799,9 +1109,9 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
// Center = 0,
|
|
|
// Insert = 1
|
|
|
//20.1.10.39
|
|
|
- int? algn = null;
|
|
|
+ string algn = null;
|
|
|
if (outline.Alignment != null) {
|
|
|
- algn = Convert.ToInt32(outline.Alignment);
|
|
|
+ algn = outline.Alignment;
|
|
|
}
|
|
|
|
|
|
/* 20.1.10.15 复合类型
|
|
@@ -811,9 +1121,9 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
ThinThick = 3, 细到粗
|
|
|
Triple = 4 三线
|
|
|
*/
|
|
|
- int? cmpd = null ;
|
|
|
+ string cmpd = null ;
|
|
|
if (outline.CompoundLineType!=null) {
|
|
|
- cmpd = Convert.ToInt32(outline.CompoundLineType);
|
|
|
+ cmpd = outline.CompoundLineType;
|
|
|
}
|
|
|
|
|
|
/* 20.1.10.31 线端类型
|
|
@@ -821,9 +1131,9 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
Square = 1,圆
|
|
|
Flat = 2 平
|
|
|
*/
|
|
|
- int? cap =null;
|
|
|
+ string cap =null;
|
|
|
if (outline.CapType != null) {
|
|
|
- cap = Convert.ToInt32(outline.CapType);
|
|
|
+ cap = outline.CapType;
|
|
|
}
|
|
|
border.outline = new HtexOutline { Width = Width, algn = algn, cmpd = cmpd, cap = cap };
|
|
|
var gradFill = outline.GetFirstChild<GradientFill>();
|
|
@@ -1447,6 +1757,21 @@ namespace HTEXLib.Helpers.ShapeHelpers
|
|
|
if (string.IsNullOrEmpty(FontColor)) {
|
|
|
FontColor = ReadAccentSchemeColors(schemeColor, slide);
|
|
|
}
|
|
|
+ if (FontColor.Replace("#", "") == "") {
|
|
|
+ var chren= slide.SlideLayoutPart.SlideMasterPart.ThemePart.Theme.ThemeElements.ColorScheme.ChildElements;
|
|
|
+ foreach(var cl in chren) {
|
|
|
+
|
|
|
+ if (schemeColor.Val == cl.LocalName) {
|
|
|
+ if (schemeColor.Val == "dk1" || schemeColor.Val == "lt1")
|
|
|
+ {
|
|
|
+ FontColor ="#"+ cl.GetFirstChild<SystemColor>().LastColor;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ FontColor ="#"+cl.GetFirstChild<RgbColorModelHex>().Val.Value; ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return FontColor;
|
|
|
}
|
|
|
|