This c# function gets the xComponent and tries to change the footer for every page but it only displays on the first page, in my rtf file the page styles are:
-
standard - first page
-
convert 1
-
convert 2
… -
convert 11
private static void AddPageNumbers(ref XComponent xComponent) { // Cast the component to a text document XTextDocument xTextDocument = (XTextDocument)xComponent; // Access the document's style families XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier)xTextDocument; XNameAccess xStyleFamilies = xStyleFamiliesSupplier.getStyleFamilies(); // Get the PageStyles XNameAccess xPageStyles = (XNameAccess)xStyleFamilies.getByName("PageStyles").Value; // Get the Default Page Style var styleNames = xPageStyles.getElementNames(); for (int i = 0; i < styleNames.Length; i++) { XStyle xPageStyle = (XStyle)xPageStyles.getByName(styleNames[i]).Value; // Get the footer text from the PageStyle XPropertySet xPropertySet = (XPropertySet)xPageStyle; XText xFooterText = (XText)xPropertySet.getPropertyValue("FooterText").Value; if (xFooterText != null) { XTextCursor xFooterCursor = xFooterText.createTextCursor(); xFooterCursor.setString("hello"); } } }
how do i make it so that the function will work on all footers of all pages in the rtf? thanks.