Invalidate doesn't hide tabs - excel

I am trying to push the limits of my understanding of the Fluent Ribbon/RibbonUI system in the Office 2007/2010 framework.
Coupling that with my knowledge and understanding of XAML design for WPF/Silverlight, i wanted to see if i could dynamically show/hide the described Office Menu items below and it seems i have FUBAR'd something up.
Please advise where i went wrong, or where i need to further develop:
CustomUI.xml
<group id="grpITOfficeMenu"
label="Office Menu">
<button id="btnShowOffice"
label="Show"
onAction="ShowOfficeTabs"/>
<button id="btnHideOffice"
label="Hide"
onAction="HideOfficeTabs" />
</group>
<group id="grpITContextualTabs"
label="Contextual Tabs" >
<button id="btnShowContext"
label="Show"
onAction="ShowContextualTabs"/>
<button id="btnHideContext"
label="Hide"
onAction="HideContextualTabs"/>
</group>
...
<officeMenu>
<button idMso="FileNew"
getVisible="OfficeGetVisible" />
<button idMso="FileOpen"
getVisible="OfficeGetVisible" />
</officeMenu>
<contextualTabs>
<tabSet idMso="TabSetSmartArtTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetChartTools"
getVisible="ContextualGetVisible"/>
<tabSet idMso="TabSetDrawingTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPictureTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotTableTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetHeaderAndFooterTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetTableToolsExcel"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotChartTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetInkTools"
getVisible="ContextualGetVisible" />
</contextualTabs>
VBA:
'Method to Refresh the RibbonUI object
Sub RefreshRibbon(tag As String)
'Check if Ribbon variable has been initialized with Ribbon Object from Excel
If Not (Rib Is Nothing) Then
'Ribbon variable has been initialized.
MyTag = tag
Rib.Invalidate
End If
End Sub
'Flip OfficeMenu Tabs visible based on #OffVisible value
Sub OfficeGetVisible(control As IRibbonControl, ByRef returnVal)
returnVal = OffVisible
End Sub
'Flip Contextual Tabs visible based on #ContVisible value
Sub ContextualGetVisible(control As IRibbonControl, ByRef returnVal)
returnVal = ContVisible
End Sub
...
'Show/Hide ContextualTabs in the IT Mode
Sub ShowContextualTabs(Optional ctrl As Variant)
ContVisible = True
RefreshRibbon tag:=MyTag
End Sub
Sub HideContextualTabs(Optional ctrl As Variant)
ContVisible = False
RefreshRibbon tag:=MyTag
End Sub
'Show/Hide OfficeMenu Tabs in the IT Mode
Sub ShowOfficeTabs(Optional ctrl As Variant)
OffVisible = True
RefreshRibbon tag:=MyTag
End Sub
Sub HideOfficeTabs(Optional ctrl As Variant)
OffVisible = False
RefreshRibbon tag:=MyTag
End Sub
Update:
Did some detailed testing and it technically works, but what I am trying to ultimately have completed is the ability to show/hide Home, Insert, Page Layout, Formulas, Data, Review, View, Developer, etc. tabs from the ribbon. I'm trying to remove the need, or necessity, of the startfromscratch attribute in the customui element.

Got it solved, had to go look at ALL of the idMso values for both TabSets & Tab objects in the Ribbon.
So here is the XML for the CustomUI to allow for Show/Hide of some of the Default (at least the ones i needed) Tab/TabSet's. Using the same Show/Hide methods above.
<customUI onLoad="s_UIOnLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<!-- Excel File Menu options, not available through Tab or TabSets -->
<officeMenu>
<button idMso="FileNew" getVisible="OfficeGetVisible" />
<button idMso="FileOpen" getVisible="OfficeGetVisible" />
</officeMenu>
<!-- Excel TabSets that only become visible when certain objects
are selected (such as ListObjects, PivotTables, Charts, etc) -->
<contextualTabs>
<tabSet idMso="TabSetChartTools" getVisible="ContextualGetVisible"/>
<tabSet idMso="TabSetDrawingTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetEquationTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetHeaderAndFooterTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetInkTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPictureTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotChartTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotTableTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSlicerTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSmartArtTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSparkline" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetTableToolsExcel" getVisible="ContextualGetVisible" />
</contextualTabs>
<tabs>
<!-- Excel Menu Tabs, these are not included in the TabSets and
must be explicitely defined -->
<tab idMso="TabAddIns" getVisible="OfficeGetVisible" />
<tab idMso="TabBackgroundRemoval" getVisible="OfficeGetVisible" />
<tab idMso="TabData" getVisible="OfficeGetVisible" />
<tab idMso="TabDeveloper" getVisible="OfficeGetVisible" />
<tab idMso="TabFormulas" getVisible="OfficeGetVisible" />
<tab idMso="TabHome" getVisible="OfficeGetVisible" />
<tab idMso="TabInsert" getVisible="OfficeGetVisible" />
<tab idMso="TabPageLayoutExcel" getVisible="OfficeGetVisible" />
<tab idMso="TabReview" getVisible="OfficeGetVisible" />
<tab idMso="TabView" getVisible="OfficeGetVisible" />
...
</tabs>
</ribbon>
</customUI>

Start from Scratch
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon startFromScratch="true"/>
</customUI>
It removes everything but the backstage.
and if you want to bring some of them back
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon startFromScratch="true">
<tabs>
<tab idMso="TabView" visible="true"/>
</tabs>
</ribbon>
</customUI>

Related

MAUI CollectionView Span Property Bug

MAUI, VS17.4 pr1, Windows.
I Set CollectionView Span value to 3, So if I have only 1 or 2 objects, the CollectionView will display nothing.
I attached a runable project on my Synology.
BugProject
BTW, ScrollBar doesn't show in the View.
Whole XAML Page:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp1.VerticalListDynamicSizeItemsPage"
Title="Vertical list (dynamic item sizing)">
<StackLayout>
<Button TextColor="Wheat"
Text="Add New "
Command="{Binding AddCommand}" />
<Button TextColor="Wheat"
Text="Delete New "
Command="{Binding DeleteCommand}" />
<CollectionView HorizontalOptions="Start"
HorizontalScrollBarVisibility="Always"
ItemsLayout="VerticalGrid, 3"
ItemsSource="{Binding Monkeys}"
VerticalScrollBarVisibility="Always">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="10">
<BoxView WidthRequest="100"
HeightRequest="100"
Color="Red" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
It's a bug, I'll create a github issue.

Blue Prism : Turn name into an email adress?

I'm building an automation that reads an excel file with two columns (name and date), stores this to a collection and then sends out calendar invites based on those same parameters.
Extracting the data and sending the invites are both working fine individually but what I need to do now is convert the column that contains the names into email address format e.g. 'Person One' into 'Person.One#emailaddress.com'.
Added to this some of the 'name' rows contain two people in the following format - 'Person One & Person Two' so I'd need to split them into two seperate email addresses so they can both receieve the calendar invite for the appropriate date.
I'm guessing that I should be looking to do this using something in the 'Utility - Strings' function? Can anyone point me in the right direction? Much appreciated, thanks
Rota Example
needs to become
New Collection
There are two major components you'll need to accomplish this conversion of a name to an email address:
Split the initial list of recipients on the & (space-ampersand-space) sequence.
For each of the recipients, calculate the e-mail address by replacing whitespaces with full stop (.) characters and appending the #email.com domain.
As such, your process would look similar to the following:
You can use this in your Blue Prism 6.9 environment by saving the following XML as a .bpprocess or .xml file and importing it using the File > Import > Process / Object menu option in the Blue Prism Interactive Client:
<process name="Test Process" version="1.0" bpversion="6.9.0.26970" narrative="" byrefcollection="true" preferredid="f848bd78-240d-4b87-82b4-ade6ea8e40d8">
<view>
<camerax>0</camerax>
<cameray>-21</cameray>
<zoom version="2">1.25</zoom>
</view>
<preconditions />
<endpoint narrative="" />
<stage stageid="81bc6e0a-2151-4fae-80d7-3ad8d2d9826a" name="Start" type="Start">
<display x="15" y="-105" />
<onsuccess>69469193-4784-4519-bd10-974fb3d7e1da</onsuccess>
</stage>
<stage stageid="b527e78b-915b-4498-bf59-5f662104bb9d" name="End" type="End">
<display x="15" y="165" />
</stage>
<stage stageid="92f4087e-5cdf-41a1-a889-088d7ef7c469" name="Stage1" type="ProcessInfo">
<display x="-195" y="-105" w="150" h="90" />
</stage>
<stage stageid="f9d08d9a-ac87-4c6b-8aa9-2dc864ce8d8d" name="Input" type="Block">
<loginhibit onsuccess="true" />
<display x="-270" y="-45" w="150" h="60" />
<font family="Segoe UI" size="10" style="Regular" color="7FB2E5" />
</stage>
<stage stageid="9fd57578-1b94-43f5-989e-f0fac142744f" name="Recipients" type="Data">
<loginhibit onsuccess="true" />
<display x="-195" y="-15" w="150" h="30" />
<datatype>text</datatype>
<initialvalue xml:space="preserve">Person One</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="5ea9beac-25e7-4560-9253-28706cf4f247" name="Output" type="Block">
<loginhibit onsuccess="true" />
<display x="-270" y="30" w="150" h="90" />
<font family="Segoe UI" size="10" style="Regular" color="7FB2E5" />
</stage>
<stage stageid="71130d29-3d68-4809-809f-11429da8ca1d" name="Recipient Contacts" type="Collection">
<display x="-195" y="75" w="150" h="60" />
<datatype>collection</datatype>
<private />
<alwaysinit />
<collectioninfo>
<field name="Name" type="text" />
<field name="Email" type="text" />
</collectioninfo>
</stage>
<stage stageid="69469193-4784-4519-bd10-974fb3d7e1da" name="Utility - Strings::Split Text" type="Action">
<loginhibit onsuccess="true" />
<display x="15" y="-60" w="120" h="30" />
<inputs>
<input type="text" name="Text to Split" friendlyname="Text to Split" narrative="The text to split" expr="[Recipients]" />
<input type="text" name="Split Char" friendlyname="Split Char" narrative="The split delimiter" expr="" & "" />
<input type="text" name="Collection Field Name" friendlyname="Collection Field Name" narrative="The name of the field for the resulting collection" expr=""Name"" />
</inputs>
<outputs>
<output type="collection" name="Split Values" friendlyname="Split Values" narrative="The resulting collection containing the split values" stage="Split Values" />
</outputs>
<onsuccess>fe157559-e2e0-4a5d-95b7-4681fc9089ce</onsuccess>
<resource object="Utility - Strings" action="Split Text" />
</stage>
<stage stageid="54353e0c-0125-4a3f-9870-8adc655e82a1" name="Split Values" type="Collection">
<display x="165" y="-60" w="90" h="60" />
<datatype>collection</datatype>
<private />
<alwaysinit />
</stage>
<stage stageid="fe157559-e2e0-4a5d-95b7-4681fc9089ce" name="Loop Split Values" type="LoopStart">
<loginhibit onsuccess="true" />
<display x="15" y="-15" w="150" h="30" />
<onsuccess>1f522616-2dbf-4355-97f1-082fa9a00406</onsuccess>
<groupid>31b533a9-c80b-49d2-bba7-2fa7f270cd72</groupid>
<looptype>ForEach</looptype>
<loopdata>Split Values</loopdata>
</stage>
<stage stageid="174f331c-b597-4053-aba2-e65f3f054f7c" name="Loop Split Values" type="LoopEnd">
<loginhibit onsuccess="true" />
<display x="15" y="120" w="150" h="30" />
<onsuccess>b527e78b-915b-4498-bf59-5f662104bb9d</onsuccess>
<groupid>31b533a9-c80b-49d2-bba7-2fa7f270cd72</groupid>
</stage>
<stage stageid="1f522616-2dbf-4355-97f1-082fa9a00406" name="Add Row to Output Collection" type="Action">
<loginhibit onsuccess="true" />
<display x="15" y="30" w="120" h="30" />
<inputs>
<input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr=""Recipient Contacts"" />
</inputs>
<onsuccess>6547bfb9-ae7e-4735-96b4-07fbca2678f0</onsuccess>
<resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" />
</stage>
<stage stageid="6547bfb9-ae7e-4735-96b4-07fbca2678f0" name="Store Name and Calculated Email for Recipient" type="MultipleCalculation">
<loginhibit onsuccess="true" />
<display x="15" y="75" w="120" h="30" />
<onsuccess>174f331c-b597-4053-aba2-e65f3f054f7c</onsuccess>
<steps>
<calculation expression="[Split Values.Name]" stage="Recipient Contacts.Name" />
<calculation expression="Replace([Split Values.Name], " ", ".") & "#email.com"" stage="Recipient Contacts.Email" />
</steps>
</stage>
</process>

set the width for boundfield in spgridview

I tried different ways to set the width for my gridview clumns but nothing worked out for me. Can some one guide me about how o achieve ths. i am including my code below...
Thanks.
<SharePoint:SPGridView ID="gvSearchResults" EnableViewState="true" runat="server"
AlternatingRowStyle-BackColor="#f4f8fd" AllowSorting="true" DataKeyNames="ID"
AutoGenerateColumns="false" OnSorting="gvxxxResults_Sorting" OnPageIndexChanging="gvxxxResults_PageIndexChanging">
<Columns>
<asp:HyperLinkField HeaderText="Name" DataTextField="FileLeafRef"
DataNavigateUrlFields="FileLeafRef" Target="_parent" DataNavigateUrlFormatString="/pp/ll/lp/llDocs/{0}"
ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false"
SortExpression="Name" ItemStyle-Width="50px" />
<asp:BoundField DataField="Home_x0020_Number" HeaderText="Home Number" NullDisplayText=" " SortExpression="Home_x0020_Number">
<HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
<ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Phone_x0020_Number" HeaderText="Phone Number" NullDisplayText=" " SortExpression="Phone_x0020_Number">
<HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
<ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
</asp:BoundField>
</Columns>
</SharePoint:SPGridView>
Have you tried using the SPBoundField control instead? Try setting the SPBoundField.ControlStyle.Width property.

Change flowScope value with commandButton

I've a boolean variable in my view-state:
<set name="flowScope.render" value="false" type="java.lang.Boolean" />
Now i render a commandButton with this variable
<p:commandButton value="Show Dates"
rendered="#{!render}"
update="table1,buttons" />
Now i want to change the value of the variable with a click on this commandButton. I tried the setPropertyActionListener, but it doesn't work:
<p:commandButton value="Show Dates" rendered="#{!render}" update="table1,buttons">
<f:setPropertyActionListener value="true" target="#{render}" />
</p:commandButton>
I don't find much about how to change the value. So how is this possible?
Now i figured it out.
I must work with transitions. In the same view-state where the variable is set, there i define two transitions:
<transition on="rendertrue">
<set name="flowScope.render" value="true" type="java.lang.Boolean" />
</transition>
<transition on="renderfalse">
<set name="flowScope.render" value="false" type="java.lang.Boolean" />
</transition>
I don't change the value of the exist variable, i just overwrite it. If this is the best or cleanes solution, i don't know, but it works.
Now i call the specific transition with the action statement in the commandButton:
<p:commandButton value="Show Date"
rendered="#{!render}" update="table1,buttons"
action="rendertrue" />
<p:commandButton value="Hide Date"
rendered="#{render}" update="table1,buttons"
action="renderfalse" />

TFS WorkItem Layout problem

I'm customizing a TFS Work Item Type, adding a 'Business Description' HTML Field, but I cannot get the Layout right:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
<Column PercentWidth="40">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Tab>
This turns out like this:
While I really want this ('Photoshopped' with MSPaint):
I have played around with the Fill properties on all three fields, have already set the MinimumSize property on the BusinessDescription field, added a group inside the left column, but I do not seem to find a solution for this.
Is this at all possible?
You'll want to create a group inside both the left and right columns:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Group>
<Column PercentWidth="100">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
</Group>
</Column>
<Column PercentWidth="40">
<Group>
<Column PercentWidth="100">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Column>
</Group>
</Tab>
You may also want to check out the Process Editor Power Tool - this provides a GUI interface to editing work item types.

Resources