Friday, August 12, 2011
Design and Run a Windows Workflow 4.0 within Excel or Word 2010
Tuesday, July 19, 2011
Host a Windows Workflow 4.0 Designer in an Office add-in
The check-in covers the following Windows Workflow 4.0 topics:
gacutil /i {FullPath}\bin\Debug\MyData.ActivityDesigners.dll |
Monday, June 20, 2011
Microsoft Patterns and Practices and Add-in Exception Logging
Topics
- Microsoft Patterns and Practices Logging Block
- Microsoft Patterns and Practices Security Block
- SharePoint 2010 Base Permissions
Sample Code
Logging Block
Logging Dialog Form |
Steps to authorize a user:
Step 3 Get the RuleProvider defined in msaccess.exe.config
Step 4 Get the current user identity
Saturday, May 21, 2011
SQL XML with Access
CREATE PROCEDURE SelectByIdList ( @productIds xml ) AS SET ARITHABORT ON -- @Products table for Products Non-contiguous XML query DECLARE @Products TABLE (ProductID int) INSERT INTO @Products (ProductID) SELECT ParamValues.ProductID.value('.','INT') FROM @productIds.nodes('/Products/ProductID') as ParamValues(ProductID) SELECT * FROM Products INNER JOIN @Products p ON Products.ProductID = p.ProductID -- Test the procedure EXEC SelectByIdList @productIds= '<Products><ProductID>37</ProductID><ProductID>6</ProductID> <ProductID>15</ProductID><ProductID>3</ProductID></Products>' |
private DataTable sp_SelectByIdList(XElement idElements) { using (StringWriter swStringWriter = new StringWriter()) { using (SqlConnection dbConnection = new SqlConnection (MyDataAddin.Properties.Settings.Default.NorthwindConnectionString)) { using (SqlCommand dbCommand = new SqlCommand("SelectByIdList", dbConnection)) { dbCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameter = new SqlParameter(); parameter.ParameterName = "@productIds"; parameter.DbType = DbType.Xml; parameter.Direction = ParameterDirection.Input; // Input Parameter parameter.Value = idElements.ToString(); dbCommand.Parameters.Add(parameter); dbConnection.Open(); SqlDataAdapter da = new SqlDataAdapter(dbCommand); northwindDataSet.sp_SelectByIdList.Clear(); da.Fill(this.northwindDataSet.sp_SelectByIdList); return this.northwindDataSet.sp_SelectByIdList; } } } } |
private void selectButton_Click(object sender, EventArgs e) { XElement xmlIdElements = new XElement("Products"); foreach (DataGridViewRow row in vw_ProductListDataGridView.Rows) { if (true == Convert.ToBoolean(row.Cells["SelectCheckbox"].Value)) { xmlIdElements.Add(new XElement("ProductID", Convert.ToInt32(row.Cells["ProductIDColumn"].Value))); } } //Bind the DataGridView sp_SelectByIdListDataGridView.DataSource = sp_SelectByIdList(xmlIdElements); } |
public void BindForm(DataRow currentRow) { access.TextBox textBox; //Fill Form from BindingSource //Set Form Textbox values based on ColumnName match foreach (DataColumn c in currentRow.Table.Columns) { if (ThisDatabase.AllForms["Dashboard"].FindControl(c.ColumnName)) { textBox = ThisDatabase.AllForms["Dashboard"].Controls(c.ColumnName) as access.TextBox; textBox.Value = currentRow[c.ColumnName].ToString(); } } textBox = null; } } } |
int rowPosition = 0; void prevCommand_Click() { if (this.SqlXmlDataGrid != null && this.SqlXmlDataGrid.Visible) { if (rowPosition > 0) { rowPosition--; this.SqlXmlDataGrid.BindForm (this.SqlXmlDataGrid.CurrentDataRow.Table.Rows[rowPosition]); } } } void nextCommand_Click() { if (this.SqlXmlDataGrid != null && this.SqlXmlDataGrid.Visible) { if (rowPosition + 1 < this.SqlXmlDataGrid.CurrentDataRow.Table.Rows.Count) { rowPosition++; this.SqlXmlDataGrid.BindForm (this.SqlXmlDataGrid.CurrentDataRow.Table.Rows[rowPosition]); } } } |
Monday, May 2, 2011
Managing Access Add-ins with a SurfaceView
Topics
- Setup the sample including troubleshooting Add-in setup
- Use the sample
- Use a SurfaceView to manage forms and reports
- Use a ribbon button
- Create custom task panes
- Create a custom Access popup form
- Use Windows Workflow 4.0 to automate Access
Sunday, April 10, 2011
Source code update
This week we will post new code to http://desktopweb.codeplex.com. The following screenshot shows the Access HTML editor improvements.
HTML Editor enhancements:
- Open content stored in an Access table
- Save content
- Common formatting including bold, italic, underline, fonts and colors
- Undo, cut, copy and paste
- Numbered list, bulleted list, outdent and indent
- DataLinks
- Find text
- Insert content via a HyperBar control (not fully implemented)
Access Addin stability is another significant improvement. An abstract SurfaceController class and corresponding FormController and ReportController class was added to provide a clean and stable model to manage Access form and report controls. Access controls can be referenced as ThisDatabase.AllForms["Dashboard"].Controls(“Budget”). The SurfaceController handles the details including ensuring that Access is always released when closed.
Silverlight WebWidgets can be included in a database as an attachment and deployed to the client.
The source code also shows more Windows Workflow 4.0 to add .NET features into Access. The idea is to create common CodeActivities that others can drop into a Workflow to automate Access.
I will upload the new source code and provide more documentation later this week …