I was wondering if it is possible to catch or customize the "New Document" action in the ribbon when you create a new document in a document library.
The reason is the following: I would like to fill in some data into the document (pragmatically through the properties) before it opens in Word. This way some default data is filled in for the user. What data is filled in depends on the Site name. This would represent a Project number, what would be used to get the specific data from a list or database.
I've come up with some other solutions that basically fill in the data, but at another point of the process of the document:
using a combination of a Workflow & filling in the data through InfoPath. This works for a library with only 1 content type (the default). Once we want to use multiple Content types it is nearly impossible to get the site name because InfoPath is not able to use the function SPContext.Current.Web.Title.
To solve the content type problem I used the Event Receiver "ItemAdding". This way the data is added when the document is being added. The disadvantage that this gives is that the data will only be visible in the document if the users opens it a second time, what isn't really user friendly.
So to optimize the user experiences and usability I would like to add the data before the document opens in word. But is it possible?
I'm using SharePoint 2010 Server, Office 2010 Professorial and Visual studio 2010 Ultimate.
Thanks in advance,
Oxillery
Related
I have never created any report in VS, now i am facing problem in adding reference to my project.
Can any one tell me the basics of Report Generation and How to add reference to our project?
The purpose of report generation is to take data from a source such as a database, XML stream or a spreadsheet, and use it to produce a document in a format which satisfies a particular human readership.
Please refer ComponentOne HelpCentral for Active Reports for topics to get started with ActiveReports.
Features of Report Generation with c# .NET:
Multiple Report Types to Fit Your Reporting Needs: Fixed Page Layout provides developers with a new way of creating reports where layout is the primary focus. Great for creating invoices, prospectus reports, forms, or other highly structured reports.
Continuous Page Layout makes it easy to create reports using tables, crosstabs, charts, and other data regions with flexible layouts.
Data Visualization: This include simple listing or groups with keep-together control, master-detail reports, sub-reports, horizontal and vertical multi-column reports, address labels and badges, or richly formatted letters with mail merge support. Simple and lightweight report controls allow you to easily create dazzling reports.
Data Binding .NET data sources allow you to connect to any of the standard databases, plus .NET in-memory objects and collections. In addition, the unbound data mode opens up the report to data from anywhere, in any form. If your application can access it, so can the report engine.
Visual Studio Integrated Design Time Support
Support for Migration from Other Reporting Tools
Global Options and Localization Support
Basic Steps in Report Generation with Active Reports:
This walkthrough is split into the following activities:
To add an ActiveReport to the Visual Studio project
Create a new Visual Studio project.
From the Project menu, select Add New Item.
In the Add New Item dialog that appears, select ActiveReports 8 Page Report and in the Name field, rename the file as rptMasterDetail.
Click the Add button to open a new fixed page report in the designer.
To connect the report to a data source
In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ReportData.
On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.
To add a dataset
In the Report Explorer, right-click the data source node and select the Add Data Set option or select Data Set from the Add button.
In the DataSet Dialog that appears, select the General page and enter the name of the dataset as CustomerOrders. This name appears as a child node to the data source icon in the Report Explorer.
On the Query page of this dialog, in the Query field enter the following SQL query.
SELECT CustomerID, Title, LastName, Quantity, Price, [Quantity]*[Price] AS
Total FROM CustomerOrders WHERE CustomerID < 1010
Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.
Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.
4.Create a layout for the report
5.To view the report
Click the preview tab to view the report at design time.
or
Open the report in the Viewer. See Using the Viewer for further information.
To add a reference in Visual C#
In Solution Explorer, right-click the project node and click Add Reference.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the components you want to reference, and then click OK.
Is it possible to create a report programmatically in Light Switch?
I would like my customer to enter data and upon saving, a report is automatically generated and saved in a specific location.
Thanks
Lightswitch doesn't have built-in reporting. There are a number of options including third-party extensions,custom silverlight controls, SQL Server Reports, and integration with microsoft office. A summary of these options is at http://msdn.microsoft.com/en-us/library/vstudio/jj635143.aspx If your program operates in a desktop environment using office may be the easiest. I've used http://blogs.msdn.com/b/bethmassi/archive/2011/09/22/fun-with-the-office-integration-pack-extension-for-lightswitch.aspx as a guide successfully. You can even automatically save (as an office file or a PDF) to a specific file path. As far as I know, if you are running in-browser you will not be able to automatically save the file - but there are still plenty of options.
I used Open XML + Word Automation to generate a word file from template and convert it to pdf. Now both word documents and generated PDFs are in the same document library. The word documents has some properties, which is added when they are created/uploaded to the library.
What I try to do now is automatically add properties to the PDFs after they are generated. The PDF will have the same properties as the Word Document that it is generated from.
At first I tried to use Event Receiver but the program doesn't seem to recognize that there's a new item (generated PDF) added into the document library.
Then I tried to use workflow (SharePoint Designer) but it doesn't work either(Failed to Start). The Outcome says "Workflow AddPDFData was canceled by System Account" and "AddPDFData failed to start". The workflow is set to start when an item is created. I know the workflow itself is correct because it works fine when I set it to start when an item is changed.
Please suggest if there's anything that I might do wrong, or if there is any approach that I can use. Any idea/suggestion will be highly appreciated.
Thanks!
It's a real pain that event receivers don't fire when the document is generated, however, you can definitely use a workflow and 'AutoStartOnCreate'. It works, I have done it. At least it does for Visual Studio 2010 created workflows in SharePoint 2010.
I can't say what the problem is with your workflow, but I suggest that if you add any item to the list the workflow will 'failed on start' for that item, not just the WAS generated items. That error usually means that the workflow can't validate correctly - bad correlation tokens, missing required something etc, you can look elsewhere for more detail.
The application I'm writing has a need for a solution to the following situation:
Salesman and customer is located offsite. They are finalizing a list of requirements, and will input business data that at some point need to be inputed in the onsite database.
My idea is that the salesperson gets a InfoPath document that is almost completed with default values and heads over to the customer. While at the customer the document is updated to satisfy the customer's need. I must also cover that the document is passed back and forth by email between the salesperson and the customer.
When the salesperson returns to the office he uploads the InfoPath into the database and the order is updated with few user interactions.
Now to the questions:
Is this a workable/sensible solution? Other suggestions to how to solve this?
How do I ensure that form and data stays together when the salesperson takes the document on a USB stick or it's emailed to the customer?
How do I (with C# code) fill a form with default values?
How do I read back the changes?
Sharepoint is not an option.
Some issues that you will need to think about
will customer have infopath installed and therfore may not be able to view the document.
If you email the document or need a customer to view it, generally only the data is transmitted with a pointer to the Form Template. If you want the customer to update it and send it back, then the template will need to be located somewhere publicily accesseable.
The data is stored as an XML document so as part of the startup you could detect that it is a new form set the defaults that you need.
when you publish a form to a networked folder it will also ask for a local path for the form. this allows for a disconected scenarios.
From my experience, InfoPath is a great tool when you have control over the environment. It starts to break down as a viable option once you get outside a controled environment, because you then have to start jumping through hoops to make it work as it should.
EDIT
One you loose control of the environment I think that a web interface would be the way to go.
The sales person could create a new document on the website with the back-end populating all the defaults necessary. A link to the document could be emailed to the customer, who could update their stuff via the web interface and then sales person can then finalise the process.
A client wants to have a lookup field for customer name found in a database as metadata on a Word document in a document library. They have a code which represents a group of customers and one of them should be used as customer name as metadata as well as the customer code inside the document.
Since editing the metadata in Word leaves no room for extra logic like external database lookup, right?, we have to tweak the EditForm.aspx with Asp.Net or java script to add the functionality to lookup external data.
The hard part is that we need to make the user fill in the metadata in SharePoint before the document is opened. Otherwise the user must create, close, edit metadata and then re open the document. The default behavior of SharePoint is to open the document first and let the user edit the metadata inside Word.
My first thought was to create a custom action for each content type and redirects the user to a page that creates the document in code and then brings the user to the EditForm page. Alternatively use codebehind for the custom action to create the document and let the user edit metadata in the EditForm. Clicking OK after that would save the metadata and bring up the document itself.
Then I stumbled upon EventRecievers and thought that might solve my problem. To intercept the creation of the document and send the user to the EditForm page first.
What is your thoughts on this, and how would you solve this problem?
This sounds like a job for the Business Data Catalog, that allows for incorporating external data inside your sharepoint lists (i.e. as a column). This does require a SharePoint 2007 Enterprise license.