summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odk/CustomTarget_build-examples_java.mk2
-rw-r--r--odk/Package_examples.mk21
-rw-r--r--odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/FirstLoadComponent.cs99
-rw-r--r--odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile75
-rw-r--r--odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/HelloTextTableShape.cs300
-rw-r--r--odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile75
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile75
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/PathSettingsTest.cs95
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/Makefile (renamed from odk/examples/DevelopersGuide/OfficeDev/PathSettings/Makefile)2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/PathSettingsTest.java (renamed from odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java)0
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile75
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/PathSubstitutionTest.cs77
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile75
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminateListener.cs40
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminationTest.cs57
-rw-r--r--odk/examples/dotnet/WriterDemo/csharp/Makefile75
-rw-r--r--odk/examples/dotnet/WriterDemo/csharp/WriterDemo.cs144
-rw-r--r--odk/examples/dotnet/WriterDemo/fsharp/Makefile75
-rw-r--r--odk/examples/dotnet/WriterDemo/fsharp/WriterDemo.fs139
-rw-r--r--odk/examples/dotnet/WriterDemo/vbasic/Makefile75
-rw-r--r--odk/examples/dotnet/WriterDemo/vbasic/WriterDemo.vb145
21 files changed, 1717 insertions, 4 deletions
diff --git a/odk/CustomTarget_build-examples_java.mk b/odk/CustomTarget_build-examples_java.mk
index cec90d4066ad..b9e942e5a6d4 100644
--- a/odk/CustomTarget_build-examples_java.mk
+++ b/odk/CustomTarget_build-examples_java.mk
@@ -33,7 +33,7 @@ my_example_dirs_java = \
DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection \
DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java \
DevelopersGuide/OfficeDev/Linguistic \
- DevelopersGuide/OfficeDev/PathSettings \
+ DevelopersGuide/OfficeDev/PathSettings/java \
DevelopersGuide/OfficeDev/PathSubstitution/java \
DevelopersGuide/OfficeDev/TerminationTest/java \
DevelopersGuide/ProfUNO/InterprocessConn \
diff --git a/odk/Package_examples.mk b/odk/Package_examples.mk
index b2f2ba90244c..82fc78c93c2e 100644
--- a/odk/Package_examples.mk
+++ b/odk/Package_examples.mk
@@ -189,6 +189,8 @@ $(eval $(call gb_Package_add_files_with_dir,odk_examples,$(SDKDIRNAME)/examples,
DevelopersGuide/FirstSteps/FirstUnoContact/python/FirstUnoContact.py \
DevelopersGuide/FirstSteps/FirstLoadComponent/cxx/FirstLoadComponent.cxx \
DevelopersGuide/FirstSteps/FirstLoadComponent/cxx/Makefile \
+ DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/FirstLoadComponent.cs \
+ DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile \
DevelopersGuide/FirstSteps/FirstLoadComponent/java/FirstLoadComponent.java \
DevelopersGuide/FirstSteps/FirstLoadComponent/java/Makefile \
DevelopersGuide/FirstSteps/FirstLoadComponent/basic/FirstLoadComponent.bas \
@@ -196,6 +198,8 @@ $(eval $(call gb_Package_add_files_with_dir,odk_examples,$(SDKDIRNAME)/examples,
DevelopersGuide/FirstSteps/FirstLoadComponent/python/DualComponentLoader.py \
DevelopersGuide/FirstSteps/HelloTextTableShape/cxx/HelloTextTableShape.cxx \
DevelopersGuide/FirstSteps/HelloTextTableShape/cxx/Makefile \
+ DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/HelloTextTableShape.cs \
+ DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile \
DevelopersGuide/FirstSteps/HelloTextTableShape/java/HelloTextTableShape.java \
DevelopersGuide/FirstSteps/HelloTextTableShape/java/Makefile \
DevelopersGuide/FirstSteps/HelloTextTableShape/basic/HelloTextTableShape.bas \
@@ -324,13 +328,20 @@ $(eval $(call gb_Package_add_files_with_dir,odk_examples,$(SDKDIRNAME)/examples,
DevelopersGuide/OfficeDev/MenuElement.java \
DevelopersGuide/OfficeDev/Number_Formats.java \
DevelopersGuide/OfficeDev/OfficeConnect.java \
- DevelopersGuide/OfficeDev/PathSettings/Makefile \
- DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java \
+ DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile \
+ DevelopersGuide/OfficeDev/PathSettings/csharp/PathSettingsTest.cs \
+ DevelopersGuide/OfficeDev/PathSettings/java/Makefile \
+ DevelopersGuide/OfficeDev/PathSettings/java/PathSettingsTest.java \
+ DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile \
+ DevelopersGuide/OfficeDev/PathSubstitution/csharp/PathSubstitutionTest.cs \
DevelopersGuide/OfficeDev/PathSubstitution/java/Makefile \
DevelopersGuide/OfficeDev/PathSubstitution/java/PathSubstitutionTest.java \
DevelopersGuide/OfficeDev/PathSubstitution/python/path_substitution_test.py \
DevelopersGuide/OfficeDev/TerminationTest/cxx/Makefile \
DevelopersGuide/OfficeDev/TerminationTest/cxx/TerminationTest.cxx \
+ DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile \
+ DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminateListener.cs \
+ DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminationTest.cs \
DevelopersGuide/OfficeDev/TerminationTest/java/Makefile \
DevelopersGuide/OfficeDev/TerminationTest/java/TerminateListener.java \
DevelopersGuide/OfficeDev/TerminationTest/java/TerminationTest.java \
@@ -466,6 +477,12 @@ $(eval $(call gb_Package_add_files_with_dir,odk_examples,$(SDKDIRNAME)/examples,
cpp/counter/countermain.cxx \
cpp/remoteclient/Makefile \
cpp/remoteclient/remoteclient.cxx \
+ dotnet/WriterDemo/csharp/Makefile \
+ dotnet/WriterDemo/csharp/WriterDemo.cs \
+ dotnet/WriterDemo/fsharp/Makefile \
+ dotnet/WriterDemo/fsharp/WriterDemo.fs \
+ dotnet/WriterDemo/vbasic/Makefile \
+ dotnet/WriterDemo/vbasic/WriterDemo.vb \
java/DocumentHandling/DocumentConverter.java \
java/DocumentHandling/DocumentLoader.java \
java/DocumentHandling/DocumentPrinter.java \
diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/FirstLoadComponent.cs b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/FirstLoadComponent.cs
new file mode 100644
index 000000000000..9205d030a642
--- /dev/null
+++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/FirstLoadComponent.cs
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.beans;
+using com.sun.star.container;
+using com.sun.star.frame;
+using com.sun.star.lang;
+using com.sun.star.sheet;
+using com.sun.star.table;
+using com.sun.star.uno;
+
+try
+{
+ XComponentContext xContext = NativeBootstrap.bootstrap();
+ if (xContext is null)
+ Console.Error.WriteLine("Could not bootstrap office");
+
+ XMultiComponentFactory xServiceManager = xContext.getServiceManager();
+
+ IQueryInterface desktop = xServiceManager
+ .createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
+ XComponentLoader xComponentLoader = desktop.query<XComponentLoader>();
+
+ PropertyValue[] loadProps = Array.Empty<PropertyValue>();
+ XComponent xSpreadsheetComponent = xComponentLoader
+ .loadComponentFromURL("private:factory/scalc", "_blank", 0, loadProps);
+
+ XSpreadsheetDocument xSpreadsheetDocument = xSpreadsheetComponent
+ .query<XSpreadsheetDocument>();
+
+ XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets();
+ xSpreadsheets.insertNewByName("MySheet", 0);
+ Type elemType = xSpreadsheets.getElementType();
+ Console.WriteLine(elemType.FullName);
+
+ Any sheet = xSpreadsheets.getByName("MySheet");
+ XSpreadsheet xSpreadsheet = sheet.castOrDefault<XSpreadsheet>();
+
+ XCell xCell = xSpreadsheet.getCellByPosition(0, 0);
+ xCell.setValue(21);
+ xCell = xSpreadsheet.getCellByPosition(0, 1);
+ xCell.setValue(21);
+ xCell = xSpreadsheet.getCellByPosition(0, 2);
+ xCell.setFormula("=sum(A1:A2)");
+
+ XPropertySet xCellProps = xCell.query<XPropertySet>();
+ xCellProps.setPropertyValue("CellStyle", new Any("Result"));
+
+ XModel xSpreadsheetModel = xSpreadsheetComponent.query<XModel>();
+ XController xSpreadsheetController = xSpreadsheetModel.getCurrentController();
+ XSpreadsheetView xSpreadsheetView = xSpreadsheetController.query<XSpreadsheetView>();
+ xSpreadsheetView.setActiveSheet(xSpreadsheet);
+
+ // Example usage of enum values
+ xCellProps.setPropertyValue("VertJustify", new Any(CellVertJustify.TOP));
+
+ // Example usage of PropertyValue structs
+ loadProps = new PropertyValue[1]
+ {
+ new PropertyValue()
+ {
+ Name = "AsTemplate",
+ Value = new Any(true),
+ }
+ };
+
+ // Uncomment to load a Calc file as template
+ //xSpreadsheetComponent = xComponentLoader.loadComponentFromURL(
+ // "file:///c:/temp/DataAnalysys.ods", "_blank", 0, loadProps);
+
+ // Example usage of XEnumerationAccess
+ XCellRangesQuery xCellQuery = sheet.castOrDefault<XCellRangesQuery>();
+ XSheetCellRanges xFormulaCells = xCellQuery.queryContentCells(CellFlags.FORMULA);
+ XEnumerationAccess xFormulas = xFormulaCells.getCells();
+ XEnumeration xFormulaEnum = xFormulas.createEnumeration();
+
+ while (xFormulaEnum.hasMoreElements())
+ {
+ Any formulaCell = xFormulaEnum.nextElement();
+ xCell = formulaCell.castOrDefault<XCell>();
+ XCellAddressable xCellAddress = xCell.query<XCellAddressable>();
+ Console.WriteLine($"Formula cell in column {xCellAddress.getCellAddress().Column}, row {xCellAddress.getCellAddress().Row} contains {xCell.getFormula()}");
+ }
+
+ return 0;
+}
+catch (UnoException e)
+{
+ Console.Error.WriteLine(e.Message);
+
+ return 1;
+} \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile
new file mode 100644
index 000000000000..2cd58d246ac7
--- /dev/null
+++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the FirstLoadComponent example of the Developers Guide.
+
+PRJ = ../../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = FirstLoadComponent
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/HelloTextTableShape.cs b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/HelloTextTableShape.cs
new file mode 100644
index 000000000000..8d67ccf01427
--- /dev/null
+++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/HelloTextTableShape.cs
@@ -0,0 +1,300 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.awt;
+using com.sun.star.beans;
+using com.sun.star.container;
+using com.sun.star.drawing;
+using com.sun.star.frame;
+using com.sun.star.lang;
+using com.sun.star.sheet;
+using com.sun.star.table;
+using com.sun.star.text;
+using com.sun.star.uno;
+
+XComponentContext xRemoteContext = null;
+XMultiComponentFactory xRemoteServiceManager = null;
+
+try
+{
+ UseWriter();
+ UseCalc();
+ UseDraw();
+ return 0;
+}
+catch (UnoException e)
+{
+ Console.Error.WriteLine(e.Message);
+ return 1;
+}
+
+void UseWriter()
+{
+ // Create a new Writer document, and manipulate the text content
+ XComponent xWriterComponent = NewDocComponent("swriter");
+ XTextDocument xTextDocument = xWriterComponent.query<XTextDocument>();
+ XText xText = xTextDocument.getText();
+
+ ManipulateText(xText);
+
+ // Get the internal service factory of the document
+ XMultiServiceFactory xWriterFactory = xTextDocument.query<XMultiServiceFactory>();
+
+ // Insert a TextTable, and manipulate the text content of the cell
+ XTextContent xTextContentTable = xWriterFactory.createInstance("com.sun.star.text.TextTable").query<XTextContent>();
+ xText.insertTextContent(xText.getEnd(), xTextContentTable, false);
+
+ XCellRange xCellRange = xTextContentTable.query<XCellRange>();
+ XCell xCell = xCellRange.getCellByPosition(0, 1);
+ XText xCellText = xCell.query<XText>();
+
+ ManipulateText(xCellText);
+ ManipulateTable(xCellRange);
+
+ XShape xWriterShape = xWriterFactory.createInstance("com.sun.star.drawing.RectangleShape").query<XShape>();
+ xWriterShape.setSize(new Size(10000, 10000));
+ XTextContent xTextContentShape = xWriterShape.query<XTextContent>();
+
+ xText.insertTextContent(xText.getEnd(), xTextContentShape, false);
+
+ // Wrap the text inside the shape
+ XPropertySet xShapeProps = xWriterShape.query<XPropertySet>();
+ xShapeProps.setPropertyValue("TextContourFrame", new Any(true));
+
+ XText xShapeText = xWriterShape.query<XText>();
+
+ ManipulateText(xShapeText);
+ ManipulateShape(xWriterShape);
+
+ // Create and name a bookmark
+ IQueryInterface bookmark = xWriterFactory.createInstance("com.sun.star.text.Bookmark");
+ XNamed xNamed = bookmark.query<XNamed>();
+ xNamed.setName("MyUniqueBookmarkName");
+
+ // Insert the bookmark at the end of the document
+ XTextContent xTextContent = bookmark.query<XTextContent>();
+ xText.insertTextContent(xText.getEnd(), xTextContent, false);
+
+ // Get all bookmarks from the XBookmarksSupplier
+ XBookmarksSupplier xBookmarksSupplier = xWriterComponent.query<XBookmarksSupplier>();
+ XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();
+ XTextContent xFoundBookmark = xNamedBookmarks.getByName("MyUniqueBookmarkName").cast<XTextContent>();
+ XTextRange xFound = xFoundBookmark.getAnchor();
+ xFound.setString(" The throat mike, glued to her neck, "
+ + "looked as much as possible like an analgesic dermadisk.");
+
+ // Get all tables from the XTextTablesSupplier
+ XTextTablesSupplier xTablesSupplier = xWriterComponent.query<XTextTablesSupplier>();
+ XNameAccess xNamedTables = xTablesSupplier.getTextTables();
+ XIndexAccess xIndexedTables = xNamedTables.query<XIndexAccess>();
+
+ // Get the tables
+ XPropertySet xTableProps = null;
+ for (int i = 0; i < xIndexedTables.getCount(); i++)
+ {
+ xTableProps = xIndexedTables.getByIndex(i).cast<XPropertySet>();
+ xTableProps.setPropertyValue("BackColor", new Any(0xC8FFB9));
+ }
+}
+
+void UseCalc()
+{
+ // Create a new Calc document, and manipulate text in a cell
+ XComponent xCalcComponent = NewDocComponent("scalc");
+ XSpreadsheetDocument xCalcDocument = xCalcComponent.query<XSpreadsheetDocument>();
+ XSpreadsheetDocument xSpreadsheetDocument = xCalcDocument.query<XSpreadsheetDocument>();
+
+ XIndexAccess xIndexedSheets = xSpreadsheetDocument.getSheets().query<XIndexAccess>();
+ XCellRange xSpreadsheetCells = xIndexedSheets.getByIndex(0).cast<XCellRange>();
+
+ // Get cell A2 from the first sheet
+ XCell xCell = xSpreadsheetCells.getCellByPosition(0, 1);
+ XText xCellText = xCell.query<XText>();
+
+ XPropertySet xCellProps = xCell.query<XPropertySet>();
+ xCellProps.setPropertyValue("IsTextWrapped", new Any(true));
+
+ ManipulateText(xCellText);
+ ManipulateTable(xSpreadsheetCells);
+
+ // Get the internal service factory of the document
+ XMultiServiceFactory xCalcFactory = xCalcDocument.query<XMultiServiceFactory>();
+ XDrawPageSupplier xDrawPageSupplier = xIndexedSheets.getByIndex(0).cast<XDrawPageSupplier>();
+ XDrawPage xDrawPage = xDrawPageSupplier.getDrawPage();
+
+ // Create and insert a RectangleShape, and manipulate its shape text
+ XShape xCalcShape = xCalcFactory.createInstance("com.sun.star.drawing.RectangleShape").query<XShape>();
+ xCalcShape.setSize(new Size(10000, 10000));
+ xCalcShape.setPosition(new Point(7000, 3000));
+ xDrawPage.add(xCalcShape);
+
+ // Wrap the text inside the shape
+ XPropertySet xShapeProps = xCalcShape.query<XPropertySet>();
+ xShapeProps.setPropertyValue("TextContourFrame", new Any(true));
+
+ XText xShapeText = xCalcShape.query<XText>();
+ ManipulateText(xShapeText);
+ ManipulateShape(xCalcShape);
+}
+
+void UseDraw()
+{
+ // Create a new Draw document, and insert a rectangle
+ XComponent xDrawComponent = NewDocComponent("sdraw");
+ XDrawPagesSupplier xDrawPagesSupplier = xDrawComponent.query<XDrawPagesSupplier>();
+
+ XIndexAccess xIndexedDrawPages = xDrawPagesSupplier.getDrawPages();
+ XDrawPage xDrawPage = xIndexedDrawPages.getByIndex(0).cast<XDrawPage>();
+
+ // Get the internal service factory of the document
+ XMultiServiceFactory xDrawFactory = xDrawComponent.query<XMultiServiceFactory>();
+ XShape xDrawShape = xDrawFactory.createInstance("com.sun.star.drawing.RectangleShape").query<XShape>();
+ xDrawShape.setSize(new Size(10000, 20000));
+ xDrawShape.setPosition(new Point(5000, 5000));
+ xDrawPage.add(xDrawShape);
+
+ // Wrap the text inside the shape
+ XPropertySet xShapeProps = xDrawShape.query<XPropertySet>();
+ xShapeProps.setPropertyValue("TextContourFrame", new Any(true));
+
+ XText xShapeText = xDrawShape.query<XText>();
+ ManipulateText(xShapeText);
+ ManipulateShape(xDrawShape);
+}
+
+void ManipulateText(XText xText)
+{
+ // Set the entire text at once
+ xText.setString("He lay flat on the brown, pine-needled floor of the forest, "
+ + "his chin on his folded arms, and high overhead the wind blew in the tops "
+ + "of the pine trees.");
+
+ // Create a text cursor for selecting and formatting
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = xTextCursor.query<XPropertySet>();
+
+ // Use the cursor to select "He lay", and apply bold and italic formatting
+ xTextCursor.gotoStart(false);
+ xTextCursor.goRight(6, true);
+
+ xCursorProps.setPropertyValue("CharPosture", new Any(FontSlant.ITALIC));
+ xCursorProps.setPropertyValue("CharWeight", new Any(FontWeight.BOLD));
+
+ xTextCursor.gotoEnd(false);
+ xText.insertString(xTextCursor.getStart(),
+ " The mountainside sloped gently where he lay; "
+ + "but below it was steep and he could see the dark of the oiled road "
+ + "winding through the pass. There was a stream alongside the road "
+ + "and far down the pass he saw a mill beside the stream and the falling water "
+ + "of the dam, white in the summer sunlight.", false);
+ xText.insertString(xTextCursor.getStart(), "\n \"Is that the mill?\" he asked.", false);
+}
+
+void ManipulateTable(XCellRange xCellRange)
+{
+ // Set column titles and a cell value
+ XCell xCell = xCellRange.getCellByPosition(0, 0);
+ XText xCellText = xCell.query<XText>();
+ xCellText.setString("Quotation");
+
+ xCell = xCellRange.getCellByPosition(1, 0);
+ xCellText = xCell.query<XText>();
+ xCellText.setString("Year");
+
+ xCell = xCellRange.getCellByPosition(1, 1);
+ xCell.setValue(1940);
+
+ XCellRange xSelectedCells = xCellRange.getCellRangeByName("A1:B1");
+ XPropertySet xCellProps = xSelectedCells.query<XPropertySet>();
+
+ string backColorPropertyName = null;
+ XPropertySet xTableProps = null;
+
+ // Format the table headers and borders
+ XServiceInfo xServiceInfo = xCellRange.query<XServiceInfo>();
+ if (xServiceInfo.supportsService("com.sun.star.sheet.Spreadsheet"))
+ {
+ backColorPropertyName = "CellBackColor";
+ xSelectedCells = xCellRange.getCellRangeByName("A1:B2");
+ xTableProps = xSelectedCells.query<XPropertySet>();
+ }
+ else if (xServiceInfo.supportsService("com.sun.star.text.TextTable"))
+ {
+ backColorPropertyName = "BackColor";
+ xTableProps = xCellRange.query<XPropertySet>();
+ }
+ // Set cell background color
+ xCellProps.setPropertyValue(backColorPropertyName, new Any(0x99CCFF));
+
+ // Set table borders (blue line, width 10)
+ BorderLine theLine = new BorderLine()
+ {
+ Color = 0x000099,
+ OuterLineWidth = 10,
+ };
+
+ // Use the above defined line for all borders and enable them
+ TableBorder bord = new TableBorder()
+ {
+ VerticalLine = theLine,
+ HorizontalLine = theLine,
+ LeftLine = theLine,
+ RightLine = theLine,
+ TopLine = theLine,
+ BottomLine = theLine,
+
+ IsVerticalLineValid = true,
+ IsHorizontalLineValid = true,
+ IsLeftLineValid = true,
+ IsRightLineValid = true,
+ IsTopLineValid = true,
+ IsBottomLineValid = true,
+ };
+ xTableProps.setPropertyValue("TableBorder", new Any(bord));
+
+ bord = xTableProps.getPropertyValue("TableBorder").cast<TableBorder>();
+ Console.WriteLine(bord.TopLine.Color);
+}
+
+void ManipulateShape(XShape xShape)
+{
+ XPropertySet xShapeProps = xShape.query<XPropertySet>();
+ xShapeProps.setPropertyValue("FillColor", new Any(0x99CCFF));
+ xShapeProps.setPropertyValue("LineColor", new Any(0x000099));
+ xShapeProps.setPropertyValue("RotateAngle", new Any(3000));
+ xShapeProps.setPropertyValue("TextLeftDistance", new Any(0));
+ xShapeProps.setPropertyValue("TextRightDistance", new Any(0));
+ xShapeProps.setPropertyValue("TextUpperDistance", new Any(0));
+ xShapeProps.setPropertyValue("TextLowerDistance", new Any(0));
+}
+
+XComponent NewDocComponent(string docType)
+{
+ XMultiComponentFactory xRemoteServiceManager = GetRemoteServiceManager();
+
+ XComponentLoader xComponentLoader = xRemoteServiceManager
+ .createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext)
+ .query<XComponentLoader>();
+
+ string loadUrl = $"private:factory/{docType}";
+ return xComponentLoader.loadComponentFromURL(loadUrl, "_blank", 0, new PropertyValue[0]);
+}
+
+XMultiComponentFactory GetRemoteServiceManager()
+{
+ if (xRemoteContext == null && xRemoteServiceManager == null)
+ {
+ xRemoteContext = NativeBootstrap.bootstrap();
+ Console.WriteLine("Connected to a running office ...");
+
+ xRemoteServiceManager = xRemoteContext.getServiceManager();
+ }
+ return xRemoteServiceManager;
+} \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile
new file mode 100644
index 000000000000..b30bfb7afcbd
--- /dev/null
+++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the HelloTextTableShape example of the Developers Guide.
+
+PRJ = ../../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = HelloTextTableShape
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile
new file mode 100644
index 000000000000..5509df52153a
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the PathSettingsTest example of the Developers Guide.
+
+PRJ = ../../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = PathSettingsTest
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/PathSettingsTest.cs b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/PathSettingsTest.cs
new file mode 100644
index 000000000000..b03f5abc2b00
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/csharp/PathSettingsTest.cs
@@ -0,0 +1,95 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.beans;
+using com.sun.star.lang;
+using com.sun.star.uno;
+using com.sun.star.util;
+
+// List of pre-defined path variables supported by the PathSettings service
+string[] predefinedPathProperties =
+{
+ "Addin", "AutoCorrect", "AutoText", "Backup", "Basic",
+ "Bitmap", "Config", "Dictionary", "Favorite", "Filter",
+ "Gallery", "Graphic", "Help", "Linguistic", "Module",
+ "Palette", "Plugin", "Storage", "Temp", "Template",
+ "UIConfig", "UserConfig", "UserDictionary", "Work"
+};
+
+// Provides an example for accessing and using the PathSettings service
+try
+{
+ // Start a new office process and get the remote office context
+ XComponentContext context = NativeBootstrap.bootstrap();
+ Console.WriteLine("Connected to a running office...");
+
+ XPropertySet pathSettings = thePathSettings.get(context);
+ WorkWithPathSettings(pathSettings);
+
+ return 0;
+}
+catch (Exception e)
+{
+ Console.Error.WriteLine(e);
+
+ return 1;
+}
+
+// Retrieve and set path properties using the PathSettings service
+void WorkWithPathSettings(XPropertySet pathSettings)
+{
+ if (pathSettings != null)
+ {
+ foreach (string prop in predefinedPathProperties)
+ {
+ try
+ {
+ string value = pathSettings.getPropertyValue(prop).cast<string>();
+ Console.WriteLine($"Property = {prop} | Path = {value}");
+ }
+ catch (UnknownPropertyException)
+ {
+ Console.Error.WriteLine($"UnknownPropertyException was thrown while accessing {prop}");
+ }
+ catch (WrappedTargetException)
+ {
+ Console.Error.WriteLine($"WrappedTargetException was thrown while accessing {prop}");
+ }
+ }
+
+ // Try to modify the work path property.
+ // After running this example you should see the new value of "My Documents"
+ // in the Paths tab, accessible via "Tools - Options - LibreOffice - Paths".
+ // The change can be reverted through the Paths tab as well.
+ try
+ {
+ pathSettings.setPropertyValue("Work", new Any("$(temp)"));
+ string value = pathSettings.getPropertyValue("Work").cast<string>();
+ Console.WriteLine("Note: The example changes your current work path setting!");
+ Console.WriteLine($"The work path should now be {value}");
+ }
+ catch (UnknownPropertyException)
+ {
+ Console.Error.WriteLine("UnknownPropertyException was thrown while setting Work path");
+ }
+ catch (WrappedTargetException)
+ {
+ Console.Error.WriteLine("WrappedTargetException was thrown while setting Work path");
+ }
+ catch (PropertyVetoException)
+ {
+ Console.Error.WriteLine("PropertyVetoException was thrown while setting Work path");
+ }
+ catch (IllegalArgumentException)
+ {
+ Console.Error.WriteLine("IllegalArgumentException was thrown while setting Work path");
+ }
+ }
+}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/Makefile b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/Makefile
index bc55266efb84..631f32a8a40f 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/Makefile
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/Makefile
@@ -34,7 +34,7 @@
# Builds the OfficeDevPathSettingsTest example of the Developers Guide.
-PRJ=../../../..
+PRJ=../../../../..
SETTINGS=$(PRJ)/settings
include $(SETTINGS)/settings.mk
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/PathSettingsTest.java
index f8a17a16bd6c..f8a17a16bd6c 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/java/PathSettingsTest.java
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile
new file mode 100644
index 000000000000..363c4ca92587
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the PathSubstitutionTest example of the Developers Guide.
+
+PRJ = ../../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = PathSubstitutionTest
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/PathSubstitutionTest.cs b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/PathSubstitutionTest.cs
new file mode 100644
index 000000000000..78a32fc9f773
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/csharp/PathSubstitutionTest.cs
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.beans;
+using com.sun.star.container;
+using com.sun.star.lang;
+using com.sun.star.uno;
+using com.sun.star.util;
+
+// List of pre-defined path variables supported by the path substitution service
+string[] predefinedPathVariables =
+{
+ "$(home)","$(inst)","$(prog)","$(temp)","$(user)", "$(username)",
+ "$(work)","$(path)","$(langid)","$(vlang)"
+};
+
+try
+{
+ // Start a new office process and get the remote office context
+ XComponentContext context = NativeBootstrap.bootstrap();
+ Console.WriteLine("Connected to a running office...");
+
+ XStringSubstitution pathSubst = context.getServiceManager()
+ .createInstanceWithContext("com.sun.star.comp.framework.PathSubstitution", context)
+ .query<XStringSubstitution>();
+ WorkWithPathVariables(pathSubst);
+
+ return 0;
+}
+catch (Exception e)
+{
+ Console.Error.WriteLine(e);
+
+ return 1;
+}
+
+void WorkWithPathVariables(XStringSubstitution pathSubst)
+{
+ if (pathSubst != null)
+ {
+ foreach (string pathVar in predefinedPathVariables)
+ {
+ try
+ {
+ string value = pathSubst.getSubstituteVariableValue(pathVar);
+ Console.WriteLine($"Property = {pathVar} | Path = {value}");
+ }
+ catch (NoSuchElementException)
+ {
+ Console.Error.WriteLine($"NoSuchElementException has been thrown accessing {pathVar}");
+ }
+ }
+
+ try
+ {
+ // Check the resubstitution function
+ // Use $(home) as starting point and extend the path
+ string value = pathSubst.getSubstituteVariableValue(predefinedPathVariables[0]);
+ value += "/test";
+
+ Console.WriteLine($"Path = {value}");
+ string resub = pathSubst.reSubstituteVariables(value);
+ Console.WriteLine($"Resubstituted Path = {resub}");
+ }
+ catch (NoSuchElementException)
+ {
+ Console.Error.WriteLine($"NoSuchElementException has been thrown accessing {predefinedPathVariables[0]}");
+ }
+ }
+}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile
new file mode 100644
index 000000000000..76d685fd3dcc
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the TerminationTest example of the Developers Guide.
+
+PRJ = ../../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = TerminationTest
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminateListener.cs b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminateListener.cs
new file mode 100644
index 000000000000..bc794a6d146b
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminateListener.cs
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.frame;
+using com.sun.star.lang;
+using com.sun.star.uno;
+
+public class TerminateListener : WeakBase, XTerminateListener, XServiceInfo
+{
+ // XTerminateListener
+ public void notifyTermination(EventObject eventObject)
+ {
+ Console.WriteLine("About to terminate...");
+ }
+
+ public void queryTermination(EventObject eventObject)
+ {
+ if (Program.atWork)
+ {
+ Console.WriteLine("Terminate while we are at work? You can't be serious ;-)!");
+ throw new TerminationVetoException();
+ }
+ }
+
+ public void disposing(EventObject eventObject) { }
+
+ // XServiceInfo
+ public string getImplementationName() => GetType().FullName;
+
+ public bool supportsService(string serviceName) => serviceName == "com.sun.star.frame.XTerminateListener";
+
+ public string[] getSupportedServiceNames() => new[] { "com.sun.star.frame.XTerminateListener" };
+}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminationTest.cs b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminationTest.cs
new file mode 100644
index 000000000000..2829514b104a
--- /dev/null
+++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/csharp/TerminationTest.cs
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.frame;
+using com.sun.star.lang;
+using com.sun.star.uno;
+
+public class Program
+{
+ public static bool atWork = false;
+
+ private static int Main()
+ {
+ try
+ {
+ // Connect to a new instance of the Office
+ XComponentContext context = NativeBootstrap.bootstrap();
+ Console.WriteLine("Connected to a running office...");
+
+ // Get a reference to the Desktop service
+ XDesktop2 desktop = Desktop.create(context);
+
+ // Create our termination request listener, and register it
+ TerminateListener listener = new TerminateListener();
+ desktop.addTerminateListener(listener);
+
+ // Try to terminate while we are at work.
+ atWork = true;
+ bool terminated = desktop.terminate();
+ Console.WriteLine("The Office {0}", terminated
+ ? "has been terminated"
+ : "is still running, we are at work");
+
+ // Try to terminate when we are NOT at work.
+ atWork = false;
+ terminated = desktop.terminate();
+ Console.WriteLine("The Office {0}", terminated
+ ? "has been terminated"
+ : "is still running. Something else prevents termination, such as the quickstarter.");
+
+ return 0;
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine(ex);
+
+ return 1;
+ }
+ }
+} \ No newline at end of file
diff --git a/odk/examples/dotnet/WriterDemo/csharp/Makefile b/odk/examples/dotnet/WriterDemo/csharp/Makefile
new file mode 100644
index 000000000000..28992ec130d4
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/csharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the WriterDemo example of the Developers Guide.
+
+PRJ = ../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = WriterDemo
+APP_LANG = cs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/dotnet/WriterDemo/csharp/WriterDemo.cs b/odk/examples/dotnet/WriterDemo/csharp/WriterDemo.cs
new file mode 100644
index 000000000000..de99e2029477
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/csharp/WriterDemo.cs
@@ -0,0 +1,144 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+using System;
+
+using com.sun.star.awt;
+using com.sun.star.beans;
+using com.sun.star.bridge;
+using com.sun.star.container;
+using com.sun.star.drawing;
+using com.sun.star.frame;
+using com.sun.star.lang;
+using com.sun.star.text;
+using com.sun.star.table;
+using com.sun.star.uno;
+
+// Connect to a running office
+XComponentContext context = NativeBootstrap.bootstrap();
+// Create a service manager of the remote office
+XMultiComponentFactory factory = context.getServiceManager();
+
+// Create the Desktop
+XDesktop desktop = Desktop.create(context);
+
+// Open a new empty writer document
+XComponentLoader componentLoader = desktop.query<XComponentLoader>();
+XComponent component = componentLoader.loadComponentFromURL(
+ "private:factory/swriter", "_blank", 0, Array.Empty<PropertyValue>());
+
+XTextDocument textDocument = component.query<XTextDocument>();
+
+// Create a text object
+XText text = textDocument.getText();
+XSimpleText simpleText = text.query<XSimpleText>();
+
+// Create a cursor object
+XTextCursor cursor = simpleText.createTextCursor();
+
+// Inserting some Text
+text.insertString(cursor, "The first line in the newly created text document.\n", false);
+
+// Create instance of a text table with 4 columns and 4 rows
+IQueryInterface textTableI = textDocument.query<XMultiServiceFactory>().createInstance("com.sun.star.text.TextTable");
+XTextTable textTable = textTableI.query<XTextTable>();
+textTable.initialize(4, 4);
+text.insertTextContent(cursor, textTable, false);
+
+// Set the table background color
+XPropertySet tablePropertySet = textTableI.query<XPropertySet>();
+tablePropertySet.setPropertyValue("BackTransparent", new Any(false));
+tablePropertySet.setPropertyValue("BackColor", new Any(0xCCCCFF));
+
+// Get first row
+XTableRows tableRows = textTable.getRows();
+Any rowAny = tableRows.query<XIndexAccess>().getByIndex(0);
+
+// Set a different background color for the first row
+XPropertySet firstRowPropertySet = rowAny.cast<XPropertySet>();
+firstRowPropertySet.setPropertyValue("BackTransparent", new Any(false));
+firstRowPropertySet.setPropertyValue("BackColor", new Any(0x6666AA));
+
+// Fill the first table row
+InsertIntoCell("A1", "FirstColumn", textTable);
+InsertIntoCell("B1", "SecondColumn", textTable);
+InsertIntoCell("C1", "ThirdColumn", textTable);
+InsertIntoCell("D1", "SUM", textTable);
+
+// Fill the remaining rows
+textTable.getCellByName("A2").setValue(22.5);
+textTable.getCellByName("B2").setValue(5615.3);
+textTable.getCellByName("C2").setValue(-2315.7);
+textTable.getCellByName("D2").setFormula("sum <A2:C2>");
+
+textTable.getCellByName("A3").setValue(21.5);
+textTable.getCellByName("B3").setValue(615.3);
+textTable.getCellByName("C3").setValue(-315.7);
+textTable.getCellByName("D3").setFormula("sum <A3:C3>");
+
+textTable.getCellByName("A4").setValue(121.5);
+textTable.getCellByName("B4").setValue(-615.3);
+textTable.getCellByName("C4").setValue(415.7);
+textTable.getCellByName("D4").setFormula("sum <A4:C4>");
+
+// Change the CharColor and add a Shadow
+XPropertySet cursorPropertySet = cursor.query<XPropertySet>();
+cursorPropertySet.setPropertyValue("CharColor", new Any(255));
+cursorPropertySet.setPropertyValue("CharShadowed", new Any(true));
+
+// Create a paragraph break
+simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, false);
+
+// Inserting colored Text.
+simpleText.insertString(cursor, " This is a colored Text - blue with shadow\n", false);
+
+// Create a paragraph break
+simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, false);
+
+// Create a TextFrame.
+IQueryInterface textFrameI = textDocument.query<XMultiServiceFactory>().createInstance("com.sun.star.text.TextFrame");
+XTextFrame textFrame = textFrameI.query<XTextFrame>();
+
+// Set the size of the frame
+Size size = new Size(15000, 400);
+textFrame.query<XShape>().setSize(size);
+
+// Set anchortype
+XPropertySet framePropertySet = textFrame.query<XPropertySet>();
+framePropertySet.setPropertyValue("AnchorType", new Any(TextContentAnchorType.AS_CHARACTER));
+
+// Insert the frame
+text.insertTextContent(cursor, textFrame, false);
+
+// Get the text object of the frame
+XText frameText = textFrame.getText();
+XSimpleText frameSimpleText = frameText.query<XSimpleText>();
+
+// Create a cursor object
+XTextCursor frameCursor = frameSimpleText.createTextCursor();
+
+// Inserting some Text
+frameSimpleText.insertString(frameCursor, "The first line in the newly created text frame.", false);
+frameSimpleText.insertString(frameCursor, "\nWith this second line the height of the frame raises.", false);
+
+// Create a paragraph break
+simpleText.insertControlCharacter(frameCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+
+// Change the CharColor and add a Shadow
+cursorPropertySet.setPropertyValue("CharColor", new Any(65536));
+cursorPropertySet.setPropertyValue("CharShadowed", new Any(false));
+
+// Insert another string
+text.insertString(cursor, "\n That's all for now !!", false);
+
+void InsertIntoCell(string cellName, string text, XTextTable textTable)
+{
+ XCell cell = textTable.getCellByName(cellName);
+ XSimpleText simpleText = cell.query<XSimpleText>();
+ simpleText.setString(text);
+} \ No newline at end of file
diff --git a/odk/examples/dotnet/WriterDemo/fsharp/Makefile b/odk/examples/dotnet/WriterDemo/fsharp/Makefile
new file mode 100644
index 000000000000..d3aaad0c6499
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/fsharp/Makefile
@@ -0,0 +1,75 @@
+# Builds the WriterDemo example of the Developers Guide.
+
+PRJ = ../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = WriterDemo
+APP_LANG = fs
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/dotnet/WriterDemo/fsharp/WriterDemo.fs b/odk/examples/dotnet/WriterDemo/fsharp/WriterDemo.fs
new file mode 100644
index 000000000000..e486dbece220
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/fsharp/WriterDemo.fs
@@ -0,0 +1,139 @@
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+open System
+open com.sun.star.awt
+open com.sun.star.beans
+open com.sun.star.bridge
+open com.sun.star.container
+open com.sun.star.drawing
+open com.sun.star.frame
+open com.sun.star.lang
+open com.sun.star.text
+open com.sun.star.table
+open com.sun.star.uno
+
+let InsertIntoCell (cellName: string, text: string, textTable: XTextTable) =
+ let cell = textTable.getCellByName(cellName)
+ let simpleText = cell.query<XSimpleText>()
+ simpleText.setString(text)
+
+// Connect to a running office
+let context = NativeBootstrap.bootstrap()
+// Create a service manager of the remote office
+let factory = context.getServiceManager()
+
+// Create the Desktop
+let desktop = Desktop.create(context)
+
+// Open a new empty writer document
+let componentLoader = desktop.query<XComponentLoader>()
+let component_ = componentLoader.loadComponentFromURL(
+ "private:factory/swriter", "_blank", 0, [||])
+
+let textDocument = component_.query<XTextDocument>()
+
+// Create a text object
+let text = textDocument.getText()
+let simpleText = text.query<XSimpleText>()
+
+// Create a cursor object
+let cursor = simpleText.createTextCursor()
+
+// Inserting some Text
+text.insertString(cursor, "The first line in the newly created text document." + Environment.NewLine, false)
+
+// Create instance of a text table with 4 columns and 4 rows
+let textTableI = textDocument.query<XMultiServiceFactory>().createInstance("com.sun.star.text.TextTable")
+let textTable = textTableI.query<XTextTable>()
+textTable.initialize(4, 4)
+text.insertTextContent(cursor, textTable, false)
+
+// Set the table background color
+let tablePropertySet = textTableI.query<XPropertySet>()
+tablePropertySet.setPropertyValue("BackTransparent", new Any(false))
+tablePropertySet.setPropertyValue("BackColor", new Any(0xCCCCFF))
+
+// Get first row
+let tableRows = textTable.getRows()
+let rowAny = tableRows.query<XIndexAccess>().getByIndex(0)
+
+// Set a different background color for the first row
+let firstRowPropertySet = rowAny.cast<XPropertySet>()
+firstRowPropertySet.setPropertyValue("BackTransparent", new Any(false))
+firstRowPropertySet.setPropertyValue("BackColor", new Any(0x6666AA))
+
+// Fill the first table row
+InsertIntoCell("A1", "FirstColumn", textTable)
+InsertIntoCell("B1", "SecondColumn", textTable)
+InsertIntoCell("C1", "ThirdColumn", textTable)
+InsertIntoCell("D1", "SUM", textTable)
+
+// Fill the remaining rows
+textTable.getCellByName("A2").setValue(22.5)
+textTable.getCellByName("B2").setValue(5615.3)
+textTable.getCellByName("C2").setValue(-2315.7)
+textTable.getCellByName("D2").setFormula("sum <A2:C2>")
+
+textTable.getCellByName("A3").setValue(21.5)
+textTable.getCellByName("B3").setValue(615.3)
+textTable.getCellByName("C3").setValue(-315.7)
+textTable.getCellByName("D3").setFormula("sum <A3:C3>")
+
+textTable.getCellByName("A4").setValue(121.5)
+textTable.getCellByName("B4").setValue(-615.3)
+textTable.getCellByName("C4").setValue(415.7)
+textTable.getCellByName("D4").setFormula("sum <A4:C4>")
+
+// Change the CharColor and add a Shadow
+let cursorPropertySet = cursor.query<XPropertySet>()
+cursorPropertySet.setPropertyValue("CharColor", new Any(255))
+cursorPropertySet.setPropertyValue("CharShadowed", new Any(true))
+
+// Create a paragraph break
+simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, false)
+
+// Inserting colored Text.
+simpleText.insertString(cursor, " This is a colored Text - blue with shadow" + Environment.NewLine, false)
+
+// Create a paragraph break
+simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, false)
+
+// Create a TextFrame.
+let textFrameI = textDocument.query<XMultiServiceFactory>().createInstance("com.sun.star.text.TextFrame")
+let textFrame = textFrameI.query<XTextFrame>()
+
+// Set the size of the frame
+let size = Size(15000, 400)
+textFrame.query<XShape>().setSize(size)
+
+// Set anchortype
+let framePropertySet = textFrame.query<XPropertySet>()
+framePropertySet.setPropertyValue("AnchorType", new Any(TextContentAnchorType.AS_CHARACTER))
+
+// Insert the frame
+text.insertTextContent(cursor, textFrame, false)
+
+// Get the text object of the frame
+let frameText = textFrame.getText()
+let frameSimpleText = frameText.query<XSimpleText>()
+
+// Create a cursor object
+let frameCursor = frameSimpleText.createTextCursor()
+
+// Inserting some Text
+frameSimpleText.insertString(frameCursor, "The first line in the newly created text frame.", false)
+frameSimpleText.insertString(frameCursor, Environment.NewLine + "With this second line the height of the frame raises.", false)
+
+// Create a paragraph break
+simpleText.insertControlCharacter(frameCursor, ControlCharacter.PARAGRAPH_BREAK, false)
+
+// Change the CharColor and add a Shadow
+cursorPropertySet.setPropertyValue("CharColor", new Any(65536))
+cursorPropertySet.setPropertyValue("CharShadowed", new Any(false))
+
+// Insert another string
+text.insertString(cursor, Environment.NewLine + " That's all for now !!", false)
diff --git a/odk/examples/dotnet/WriterDemo/vbasic/Makefile b/odk/examples/dotnet/WriterDemo/vbasic/Makefile
new file mode 100644
index 000000000000..01014c71a820
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/vbasic/Makefile
@@ -0,0 +1,75 @@
+# Builds the WriterDemo example of the Developers Guide.
+
+PRJ = ../../../..
+SETTINGS = $(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+
+# Settings
+APP_NAME = WriterDemo
+APP_LANG = vb
+
+APP_SRC_DIR = $(subst /,$(PS),$(CURDIR))
+APP_BIN_DIR = $(subst /,$(PS),$(OUT_BIN))
+APP_MISC_DIR = $(subst /,$(PS),$(OUT_MISC)/$(APP_NAME))
+
+APP_PROJ_NAME = $(APP_NAME).$(APP_LANG)proj
+APP_PROJ_FILE = $(APP_MISC_DIR)/$(APP_PROJ_NAME)
+
+APP_EXE_NAME = $(APP_NAME)$(EXE_EXT)
+APP_EXE_FILE = $(APP_BIN_DIR)/$(APP_EXE_NAME)
+
+DOTNET_FLAGS = -c Release
+LO_NUPKG_ID = LibreOffice.Bindings
+LO_NUPKG_VERSION = 0.1.0
+LO_NUPKG_DIR = $(abspath $(PRJ)/dotnet)
+
+# Targets
+.PHONY: ALL
+ALL : $(APP_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(APP_PROJ_FILE) :
+ -$(MKDIR) $(@D)
+ $(ECHO) "<Project Sdk=\"Microsoft.NET.Sdk\">" > $@
+ $(ECHO) " <PropertyGroup>" >> $@
+ $(ECHO) " <AssemblyName>$(APP_NAME)</AssemblyName>" >> $@
+ $(ECHO) " <TargetFramework>net8.0</TargetFramework>" >> $@
+ $(ECHO) " <OutputType>exe</OutputType>" >> $@
+ $(ECHO) " <PublishSingleFile>true</PublishSingleFile>" >> $@
+ $(ECHO) " <SelfContained>false</SelfContained>" >> $@
+ $(ECHO) " <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>" >> $@
+ $(ECHO) " <RestoreAdditionalProjectSources>$(LO_NUPKG_DIR)</RestoreAdditionalProjectSources>" >> $@
+ $(ECHO) " </PropertyGroup>" >> $@
+ $(ECHO) " <ItemGroup>" >> $@
+ $(ECHO) " <PackageReference Include=\"$(LO_NUPKG_ID)\" Version=\"$(LO_NUPKG_VERSION)\" />" >> $@
+ $(ECHO) " <Compile Include=\"$(APP_SRC_DIR)/*.$(APP_LANG)\" />" >> $@
+ $(ECHO) " </ItemGroup>" >> $@
+ $(ECHO) "</Project>" >> $@
+ $(ECHOLINE) >> $@
+
+$(APP_EXE_FILE) : $(APP_PROJ_FILE)
+ -$(MKDIR) $(@D)
+ $(SDK_DOTNET) publish $< $(DOTNET_FLAGS) -o $(<D)
+ $(COPY) $(<D)/$(APP_EXE_NAME) $@
+
+.PHONY: $(APP_NAME)
+$(APP_NAME) : $(APP_EXE_FILE)
+ $(ECHO) --------------------------------------------------------
+ $(ECHO) Use the following commands to run the example:
+ $(ECHO) $(MAKE) run OR $(MAKE) $(APP_NAME).run
+ $(ECHO)
+ $(ECHO) And the following commands to clean the example:
+ $(ECHO) $(MAKE) clean OR $(MAKE) $(APP_NAME).clean
+ $(ECHO) --------------------------------------------------------
+
+.PHONY: $(APP_NAME).run run
+$(APP_NAME).run run : $(APP_EXE_FILE)
+ cd $(<D) && ./$(<F)
+
+.PHONY: $(APP_NAME).clean clean
+$(APP_NAME).clean clean :
+ -$(DELRECURSIVE) $(APP_MISC_DIR)
+ -$(DEL) $(APP_EXE_FILE)
diff --git a/odk/examples/dotnet/WriterDemo/vbasic/WriterDemo.vb b/odk/examples/dotnet/WriterDemo/vbasic/WriterDemo.vb
new file mode 100644
index 000000000000..be9b076f47e0
--- /dev/null
+++ b/odk/examples/dotnet/WriterDemo/vbasic/WriterDemo.vb
@@ -0,0 +1,145 @@
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+Imports System
+
+Imports com.sun.star.awt
+Imports com.sun.star.beans
+Imports com.sun.star.bridge
+Imports com.sun.star.container
+Imports com.sun.star.drawing
+Imports com.sun.star.frame
+Imports com.sun.star.lang
+Imports com.sun.star.text
+Imports com.sun.star.table
+Imports com.sun.star.uno
+
+Module WriterDemo
+ Sub Main()
+ ' Connect to a running office
+ Dim context As XComponentContext = NativeBootstrap.bootstrap()
+ ' Create a service manager of the remote office
+ Dim factory As XMultiComponentFactory = context.getServiceManager()
+
+ ' Create the Desktop
+ Dim desktop_ As XDesktop = Desktop.create(context)
+
+ ' Open a new empty writer document
+ Dim componentLoader As XComponentLoader = desktop_.query(Of XComponentLoader)()
+ Dim component As XComponent = componentLoader.loadComponentFromURL(
+ "private:factory/swriter", "_blank", 0, Array.Empty(Of PropertyValue)())
+
+ Dim textDocument As XTextDocument = component.query(Of XTextDocument)()
+
+ ' Create a text object
+ Dim text As XText = textDocument.getText()
+ Dim simpleText As XSimpleText = text.query(Of XSimpleText)()
+
+ ' Create a cursor object
+ Dim cursor As XTextCursor = simpleText.createTextCursor()
+
+ ' Inserting some Text
+ text.insertString(cursor, "The first line in the newly created text document." & vbLf, False)
+
+ ' Create instance of a text table with 4 columns and 4 rows
+ Dim textTableI As IQueryInterface = textDocument.query(Of XMultiServiceFactory)().createInstance("com.sun.star.text.TextTable")
+ Dim textTable As XTextTable = textTableI.query(Of XTextTable)()
+ textTable.initialize(4, 4)
+ text.insertTextContent(cursor, textTable, False)
+
+ ' Set the table background color
+ Dim tablePropertySet As XPropertySet = textTableI.query(Of XPropertySet)()
+ tablePropertySet.setPropertyValue("BackTransparent", New Any(False))
+ tablePropertySet.setPropertyValue("BackColor", New Any(&HCCCCFF))
+
+ ' Get first row
+ Dim tableRows As XTableRows = textTable.getRows()
+ Dim rowAny As Any = tableRows.query(Of XIndexAccess)().getByIndex(0)
+
+ ' Set a different background color for the first row
+ Dim firstRowPropertySet As XPropertySet = rowAny.cast(Of XPropertySet)()
+ firstRowPropertySet.setPropertyValue("BackTransparent", New Any(False))
+ firstRowPropertySet.setPropertyValue("BackColor", New Any(&H6666AA))
+
+ ' Fill the first table row
+ InsertIntoCell("A1", "FirstColumn", textTable)
+ InsertIntoCell("B1", "SecondColumn", textTable)
+ InsertIntoCell("C1", "ThirdColumn", textTable)
+ InsertIntoCell("D1", "SUM", textTable)
+
+ ' Fill the remaining rows
+ textTable.getCellByName("A2").setValue(22.5)
+ textTable.getCellByName("B2").setValue(5615.3)
+ textTable.getCellByName("C2").setValue(-2315.7)
+ textTable.getCellByName("D2").setFormula("sum <A2:C2>")
+
+ textTable.getCellByName("A3").setValue(21.5)
+ textTable.getCellByName("B3").setValue(615.3)
+ textTable.getCellByName("C3").setValue(-315.7)
+ textTable.getCellByName("D3").setFormula("sum <A3:C3>")
+
+ textTable.getCellByName("A4").setValue(121.5)
+ textTable.getCellByName("B4").setValue(-615.3)
+ textTable.getCellByName("C4").setValue(415.7)
+ textTable.getCellByName("D4").setFormula("sum <A4:C4>")
+
+ ' Change the CharColor and add a Shadow
+ Dim cursorPropertySet As XPropertySet = cursor.query(Of XPropertySet)()
+ cursorPropertySet.setPropertyValue("CharColor", New Any(255))
+ cursorPropertySet.setPropertyValue("CharShadowed", New Any(True))
+
+ ' Create a paragraph break
+ simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, False)
+
+ ' Inserting colored Text.
+ simpleText.insertString(cursor, " This is a colored Text - blue with shadow" & vbLf, False)
+
+ ' Create a paragraph break
+ simpleText.insertControlCharacter(cursor, ControlCharacter.PARAGRAPH_BREAK, False)
+
+ ' Create a TextFrame.
+ Dim textFrameI As IQueryInterface = textDocument.query(Of XMultiServiceFactory)().createInstance("com.sun.star.text.TextFrame")
+ Dim textFrame As XTextFrame = textFrameI.query(Of XTextFrame)()
+
+ ' Set the size of the frame
+ Dim size As Size = New Size(15000, 400)
+ textFrame.query(Of XShape)().setSize(size)
+
+ ' Set anchortype
+ Dim framePropertySet As XPropertySet = textFrame.query(Of XPropertySet)()
+ framePropertySet.setPropertyValue("AnchorType", New Any(TextContentAnchorType.AS_CHARACTER))
+
+ ' Insert the frame
+ text.insertTextContent(cursor, textFrame, False)
+
+ ' Get the text object of the frame
+ Dim frameText As XText = textFrame.getText()
+ Dim frameSimpleText As XSimpleText = frameText.query(Of XSimpleText)()
+
+ ' Create a cursor object
+ Dim frameCursor As XTextCursor = frameSimpleText.createTextCursor()
+
+ ' Inserting some Text
+ frameSimpleText.insertString(frameCursor, "The first line in the newly created text frame.", False)
+ frameSimpleText.insertString(frameCursor, vbLf & "With this second line the height of the frame raises.", False)
+
+ ' Create a paragraph break
+ simpleText.insertControlCharacter(frameCursor, ControlCharacter.PARAGRAPH_BREAK, False)
+
+ ' Change the CharColor and add a Shadow
+ cursorPropertySet.setPropertyValue("CharColor", New Any(65536))
+ cursorPropertySet.setPropertyValue("CharShadowed", New Any(False))
+
+ ' Insert another string
+ text.insertString(cursor, vbLf & " That's all for now !!", False)
+ End Sub
+
+ Private Sub InsertIntoCell(cellName As String, text As String, textTable As XTextTable)
+ Dim cell As XCell = textTable.getCellByName(cellName)
+ Dim simpleText As XSimpleText = cell.query(Of XSimpleText)()
+ simpleText.setString(text)
+ End Sub
+End Module \ No newline at end of file