<div dir="ltr"><div>Hello<br><br>Could you tell me if there is an example of how to get Libre Office version in .Net Core SDK? I have code which worked with the .net framework, but now the code, listed below, does not work:<p class="MsoNormal" style="margin:0in 0in 8pt;text-align:justify;text-indent:0.5in;line-height:107%;font-size:12pt;font-family:"Times New Roman",serif"><span lang="EN-US">
<br>
</span></p>

<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   Any[]
VerRequest = new Any[1];<br></span><span lang="EN-US"> <br></span><span lang="EN-US">   VerRequest[0]
= new Any(typeof(PropertyValue), new PropertyValue()<br></span><span lang="EN-US">   {<br></span><span lang="EN-US">      Name =
"nodepath",<br></span><span lang="EN-US">      Value = new
Any("/org.openoffice.Setup/Product")<br></span><span lang="EN-US">   });<br></span><span lang="EN-US"> <br></span><span lang="EN-US">   XMultiServiceFactory
ConfProvider =
m_HnComponentContext.getServiceManager().query<XMultiServiceFactory>();<br></span><span lang="EN-US">   if
(ConfProvider != null)<br></span><span lang="EN-US">   {<br></span><span lang="EN-US">    </span>    XNameAccess
ConfAccess =
(XNameAccess)ConfProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
VerRequest);</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>     if
(ConfAccess != null)</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>     {</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         return
ConfAccess.getByName("ooSetupVersion").Value as string;</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>      }</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">    }</span></blockquote>

































<div><br></div>Besides, there are another couple of issues regarding the SDK. The first is an error while setting up a proprety of a font. The code (modification of the WriterDemo.cs example) is shown below:</div><div><br>

<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">// Create a
cursor object<br></span><span lang="EN-US">XTextCursor
cursor = simpleText.createTextCursor();<br></span><span lang="EN-US"> <br></span><span lang="EN-US">cursor.query<XPropertySet>().setPropertyValue("CharWeight",
new Any(((float)200)));<br></span><span lang="EN-US">cursor.query<XPropertySet>().setPropertyValue("CharEscapement",
new Any((Int16)0));<br></span><span lang="EN-US">cursor.query<XPropertySet>().setPropertyValue("CharEscapementHeight",
new Any((Byte)100));<br></span><span lang="EN-US"> <br></span><span lang="EN-US">//
Inserting some Text<br></span><span lang="EN-US">text.insertString(cursor,
"The first line in the newly created text document.\n", false);</span></blockquote>

















<div><br></div>The 'Object reference not set to an instance of an object.' occurs on the cursor.query<XPropertySet>().setPropertyValue("CharEscapementHeight", new Any((Byte)100)); line.<br><br>The second issue occures while setting up with of table colimns. The code (modification of the same example) is shown below:</div><div><br>

<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">void
SetColumnWidth(XTextTable textTable,int ColNum, short Width)<br></span><span lang="EN-US">
{<br></span><span lang="EN-US">     Any obj =
textTable.query<XPropertySet>().getPropertyValue("TableColumnSeparators");<br></span><span lang="EN-US">     TableColumnSeparator[]
tcs = (TableColumnSeparator[])(obj.Value);<br></span><span lang="EN-US">     short Delta
= 0;<br></span><span lang="EN-US">     if (tcs !=
null)<br></span><span lang="EN-US">     {<br></span><span lang="EN-US">    </span>    if
(tcs.Length - 1 >= ColNum)</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>     {</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         if (ColNum
== 0)</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         {</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>               Delta =
(short)(Width - tcs[ColNum].Position);</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>               tcs[ColNum].Position
= Width;</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         }</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         else</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>         {</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>                  Delta =
(short)(Width - (tcs[ColNum].Position - tcs[ColNum].Position));</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>                  tcs[ColNum].Position
= (short)(Width + tcs[ColNum - 1].Position);</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>          }</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>      }</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US"> <br></span><span lang="EN-US">    </span>     Any val =
new Any(typeof(com.sun.star.text.TableColumnSeparator[]), tcs);</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>      textTable.query<XPropertySet>().setPropertyValue("TableColumnSeparators",
val);</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">   </span>   }</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">}<br></span></blockquote><div> </div> If the function is called in \sdk\examples\dotnet\WriterDemo\csharp\WriterDemo.cs, like listed below:<div><br></div><div><br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">// Get
first row<br></span><span lang="EN-US">XTableRows
tableRows = textTable.getRows();<br></span><span lang="EN-US">Any rowAny
= tableRows.query<XIndexAccess>().getByIndex(0);<br></span><span lang="EN-US"> <br></span><span lang="EN-US">SetColumnWidth(textTable,
1, 200);<br></span><span lang="EN-US"> <br></span><span lang="EN-US">// Set a
different background color for the first row<br></span><span lang="EN-US">XPropertySet
firstRowPropertySet = rowAny.cast<XPropertySet>();<br></span><span lang="EN-US">firstRowPropertySet.setPropertyValue("BackTransparent",
new Any(false));</span></blockquote><div> </div>



































































It gives an access violation error ("Attempted to read or write protected memory. This is often an indication that other memory is corrupt") on the line</div><div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span lang="EN-US">
textTable.query<XPropertySet>().setPropertyValue("TableColumnSeparators",
val);</span></blockquote><div><br></div>When I tried to get the columns of the table via the code below (the code is inserted in the  WriterDemo.cs  example too):</div><div><br><p></p>

<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span lang="EN-US">// Set the
table background color<br></span><span lang="EN-US">XPropertySet
tablePropertySet = textTableI.query<XPropertySet>();<br></span><span lang="EN-US">tablePropertySet.setPropertyValue("BackTransparent",
new Any(false));<br></span><span lang="EN-US">tablePropertySet.setPropertyValue("BackColor",
new Any(0xCCCCFF));<br></span><span lang="EN-US"> <br></span><span lang="EN-US">XTableColumns
tableCols = textTable.getColumns();<br></span><span lang="EN-US">Any colAny
= tableCols.query<XIndexAccess>().getByIndex(1);<br></span><span lang="EN-US"> <br></span><span lang="EN-US">// Get
first row<br></span><span lang="EN-US">XTableRows
tableRows = textTable.getRows();<br></span><span lang="EN-US">Any rowAny
= tableRows.query<XIndexAccess>().getByIndex(0);</span></blockquote><div> </div>





















However, the   tableCols.query<XIndexAccess>().getByIndex(1) line give another error:</div><div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span lang="EN-US">
Exception thrown: 'System.ArgumentException' in net_basetypes.dll<br></span><span lang="EN-US">
An unhandled exception of type 'System.ArgumentException' occurred in
net_basetypes.dll<br></span><span lang="EN-US">
Value of Any can only be null if Type is void. Perhaps you want Any.VOID?</span></blockquote><div> </div>Could you tell me what is a proper way to change the table column width using the .Net Core SDK?<p></p></div><div><br></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Best Regards,<div>Ilia Sokolov</div><div><br></div></div></div></div></div></div></div></div></div></div></div>