misc_bb 7 Posted July 14, 2021 It's either I'm not familiar with objects entirely or I'm desperate for help. I'm sorry in advance for asking this one but I just want to understand this further on how can this C# code be translated to Delphi? // Create a TableProperties object and specify its border information. TableProperties tblProp = new TableProperties( new TableBorders( new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 }, new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 }, new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 }, new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 }, new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 }, new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Dashed), Size = 24 } ) ); This code is part of the OpenXML library for creating word documents. Share this post Link to post
corneliusdavid 214 Posted July 14, 2021 Before you go to too much work, you might want to read this blog if you haven't already. If you really need to convert this C# code, it would be helpful to see more of the definitions of the object types but here's a first stab... var tblProp: TableProperties; TopBord: TopBorder; BotBord: BottomBorder; // ... begin TopBord := TopBorder.Create; TopBord.Val := BorderValues.Dashed; TopBord.Size := 24; BotBord := LeftBorder.Create; BotBord.Val := BorderValues.Dashed; BotBord.Size := 24; // etc. tblProp := TableProperties.Create(TableBorders.Create(TopBord, BotBord... If the xxxBorder classes have parameterized constructors, it would look closer to C#: var tblProp: TableProperties; begin tblProp := TableProperties.Create(TableBorders.Create( TopBorder.Create(BorderValues.Dashed, 24), BottomBorder.Create(BorderValues.Dashed, 24), LeftBorder.Create(BorderValues.Dashed, 24), RightBorder.Create(BorderValues.Dashed, 24), InsideHorizontalBorder.Create(BorderValues.Dashed, 24), InsideVerticalBorder(BorderValues.Dashed, 24))); Share this post Link to post
misc_bb 7 Posted July 14, 2021 @corneliusdavid Thank you for the response. Yes, I have read that blog was well. Although, in this case we are exploring on the use of the DirectOffice library from Winsock. Nothing is final yet but that blog somehow gave me a very good insight in terms of what we can do. In relation to the code above, the TableBorders and Tableproperties parameters are actually TOleEnum as define in the DirectOffice library. I will continue looking into the definitions. I highly appreciate the response. Thanks again! Share this post Link to post
Daniel 417 Posted July 14, 2021 Hi, next time please chose a more specific subject for your question. 😉 2 Share this post Link to post
misc_bb 7 Posted July 14, 2021 Sorry, Daniel. I promise this won't happen again in my future post. 🙂 Share this post Link to post