public static List <OpenDataObject> GetEveryLineAsObjectFromCSV(TextAsset csvFile) { List <OpenDataObject> csvObjects = new List <OpenDataObject>(); string[] allLines = csvFile.text.Split("\n"[0]); Regex csvRegex = new Regex(@"""[^""]*""|'[^']*'|[^,]*"); foreach (var line in allLines) { MatchCollection matches = csvRegex.Matches(line); OpenDataObject listEntry = new OpenDataObject(); ShapeFormat newShape = GetShapeFromLine(matches); if (newShape != null) { listEntry.Shape = newShape; //listEntry.Name = ... //listEntry.Street = ... //listEntry.... csvObjects.Add(listEntry); } } return(csvObjects); }
public static void UpdateShapeFormat() { string name = "updateShapeFormat.docx"; string paragraphPath = "Section/0/Body/0/Paragraph/0"; int? index = 0; string folder = "input"; string storage = null; string password = null; ShapeFormat shapeFormat = new ShapeFormat(40, 40, ShapeFormat.ShapeTypeEnum.Rectangle) { HorizontalOrigin = ShapeFormat.HorizontalOriginEnum.Page, VerticalOrigin = ShapeFormat.VerticalOriginEnum.Page, VerticalPosition = 200, HorizontalPosition = 100, FillColor = new Color(100, 100, 100), Rotation = 95, StrokeWeight = 1, StrokeColor = new Color(225, 15, 15), TextWrappingType = ShapeFormat.TextWrappingTypeEnum.Both, TextWrappingStyle = ShapeFormat.TextWrappingStyleEnum.InFrontOfText, ZOrder = 1 }; string destFilePath = "output/updateShapeFormat_output.docx"; shapesApi.UpdateShapeFormat(name, paragraphPath, index, shapeFormat, destFilePath, folder, storage, password); }
private static ShapeFormat GetShapeFromLine(MatchCollection matchedElementsOfALine) { ShapeFormat returnShape = null; foreach (var match in matchedElementsOfALine) { string lineElement = match.ToString(); if (lineElement.Contains("POINT")) { returnShape = GetPointShape(lineElement); return(returnShape); } else if (lineElement.Contains("LINESTRING")) { returnShape = GetLinestringShape(lineElement); return(returnShape); } else if (lineElement.Contains("MULTIPOLYGON")) { returnShape = GetMultipolygonShape(lineElement); return(returnShape); } else if (lineElement.Contains("POLYGON")) { returnShape = GetPolygonShape(lineElement); return(returnShape); } } return(returnShape); }
public void Initialize() { Point startPoint = new Point(1, 1); Point endPoint = new Point(10, 10); _shapeFormat = new ShapeFormat(startPoint, endPoint, ShapeType.Rectangle, false); Assert.AreEqual(1, _shapeFormat.StartPointLeft); Assert.AreEqual(1, _shapeFormat.StartPointTop); Assert.AreEqual(10, _shapeFormat.EndPointLeft); Assert.AreEqual(10, _shapeFormat.EndPointTop); Assert.AreEqual(1, _shapeFormat.ShapeType); }
public OpenDataObject(ShapeFormat shapeformat) { Shape = shapeformat; }