I have vb.net 2010 and I downloaded the support pack 6 from
http://scn.sap.com/docs/DOC-7824
I read that this version does allow the export of text from the export button inside the crystal report viewer. However, I can't find it in the list when I try to exporta a report.
Is there something that I am missing?
Export to text is supported in Report Document but it is not available in the viewer. If you are writing your own application you can use ReportDocument ExportToDisk. The first parameter for this methid is ExportFormatType and this is the enumeration
public enum ExportFormatType
{
NoFormat = 0,
CrystalReport = 1,
RichText = 2,
WordForWindows = 3,
Excel = 4,
PortableDocFormat = 5,
HTML32 = 6,
HTML40 = 7,
ExcelRecord = 8,
Text = 9,
CharacterSeparatedValues = 10,
TabSeperatedText = 11,
EditableRTF = 12,
Xml = 13,
RPTR = 14,
ExcelWorkbook = 15,
}
Related
i am working in odoo 14 and from web page. On button click i want to generate excel file. For this i have write code in controller using xlsxwriter.
But when i run code excel file generate but format not implemented.
cell_format = workbook.add_format({'font_size': '12px'})
head = workbook.add_format({'align': 'center', 'bold': True, 'font_size': '20px'})
txt = workbook.add_format({'font_size': '10px'})
bold = workbook.add_format({'bold': True})
format_qty = workbook.add_format({'num_format': '#,##0.00'})
format_amount = workbook.add_format({'num_format': '#,##0'})
Also showing following error when open file.
Removed Part: /xl/styles.xml part with XML error. (Styles) Load error. Line 2, column 297.
Repaired Records: Cell information from /xl/worksheets/sheet1.xml part
'font_size' should be integer
Do it like this
cell_format = workbook.add_format({'font_size': 12})
head = workbook.add_format({'align': 'center', 'bold': True, 'font_size': 20})
txt = workbook.add_format({'font_size': 10})
bold = workbook.add_format({'bold': True})
format_qty = workbook.add_format({'num_format': '#,##0.00'})
format_amount = workbook.add_format({'num_format': '#,##0'})
I'm trying to keep the range of pages in the PDF with 12 pages total and remove the rest
PdfReader pdfReader = new PdfReader("src/main/sample/test_doc2.pdf");
pdfReader.setUnethicalReading(true);
PdfDocument inputPDF = new PdfDocument(pdfReader);
PdfDocument outputPDF = new PdfDocument(new PdfWriter("src/main/sample/output.pdf").setSmartMode(true));
inputPDF.copyPagesTo(1, inputPDF.getNumberOfPages(), outputPDF, new PdfPageFormCopier());
Integer pages[] = {
1,
2,
3,
4,
5,
6,
7,
8,
9,
// 10,
// 11,
12
};
ListIterator<Integer> pagesList = Arrays.asList(pages).listIterator(pages.length);
while (pagesList.hasPrevious()) {
outputPDF.removePage(pagesList.previous());
}
outputPDF.close();
This works for most ranges, but for certain ones (ie, if I want to keep only pages 10 and 11) I'm getting a null pointer exception in PDFPagesTree.class::generate_tree() itext method on line 303:
assert current != null;
current.addPages(pages);
I tried with different documents, and consistently getting the null pointer exception for ranges 10-11.
This is indeed a bug in iText. As a workaround you can try calculating which pages you want to leave in the end instead of copying them first and removing some of them afterwards.
Alternatively, you can use an intermediate PDF for your result after copying pages from the source document, and then you can create another PdfDocument for removing some of the pages from the intermediate PDF and producing the final result.
Here is the example of such approach:
PdfReader pdfReader = new PdfReader(inputPdf);
pdfReader.setUnethicalReading(true);
PdfDocument inputPDF = new PdfDocument(pdfReader);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfDocument tempPDF = new PdfDocument(new PdfWriter(baos));
inputPDF.copyPagesTo(1, inputPDF.getNumberOfPages(), tempPDF, new PdfPageFormCopier());
tempPDF.close();
PdfDocument outPDF = new PdfDocument(new PdfReader(new ByteArrayInputStream(baos.toByteArray())),
new PdfWriter(outputPdf));
Integer pages[] = {
1,
2,
3,
4,
5,
6,
7,
8,
9,
// 10,
// 11,
12
};
ListIterator<Integer> pagesList = Arrays.asList(pages).listIterator(pages.length);
while (pagesList.hasPrevious()) {
outPDF.removePage(pagesList.previous());
}
outPDF.close();
I tried to plot some graphs in Linqpad with with "Util.RawHtml()" and "Dump()" but it is not working with this example from amcharts.com. I created a string variable including all the HTML source code but the result is not working.
string html = "";
using (System.Net.WebClient client = new System.Net.WebClient ())
{
html = client.DownloadString(#"http://pastebin.com/raw/pmMMwXhm");
}
Util.RawHtml(html).Dump();
Later versions of LinqPad 5 now support charting out of the box with Util.Chart. You can see the samples in the Samples Tab (next to My Queries) under
LINQPad Tutorial&Reference
Scratchpad Features
Charting with Chart
The following script is the Chart() - dual scale sample:
// Each y-series can have a different series type, and can be assigned to the secondary y-axis scale on the right.
var customers = new[]
{
new { Name = "John", TotalOrders = 1000, PendingOrders = 50, CanceledOrders = 20 },
new { Name = "Mary", TotalOrders = 1300, PendingOrders = 70, CanceledOrders = 25 },
new { Name = "Sara", TotalOrders = 1400, PendingOrders = 60, CanceledOrders = 17 },
};
customers.Chart (c => c.Name)
.AddYSeries (c => c.TotalOrders, Util.SeriesType.Spline, "Total")
.AddYSeries (c => c.PendingOrders, Util.SeriesType.Column, "Pending", useSecondaryYAxis:true)
.AddYSeries (c => c.CanceledOrders, Util.SeriesType.Column, "Cancelled", useSecondaryYAxis:true)
.Dump();
As I understand it, this will not work because the html contains scripts that will not be executed.
As an alternative, you can still use the old (and deprecated) google charts api, eg
var link = #"http://chart.apis.google.com/chart?chxt=y&chbh=a&chs=300x225&cht=bvg&chco=A2C180,3D7930&chd=t:10,20,30,40,50,60|30,35,40,45,55,60&chtt=Sample";
Util.Image (link).Dump();
or see
http://blog.divebomb.org/2012/11/dumping-charts-in-linqpad/
Not sure if it's the answer you're after but there may be value in looking at the DisplayWebPage method on the Util class in Linqpad. This correctly rendered your chart in the result window, (although there was a script error). Obviously, this may not solve your underlying issue.
I used version 5.10.00 to test this.
Answer
Finally I solved my answer with this.
((LineSeries)MyChart.Series[0]).IndependentAxis = new LinearAxis
{
Minimum = 1,
Maximum = 5,
Orientation = AxisOrientation.X,
Interval = 1,
Margin = new Thickness(10, 0, 10, 0)
};
((LineSeries)MyChart.Series[0]).Clip = null;
((LineSeries)MyChart.Series[0]).Margin = new Thickness(10, 0, 10, 0);
I am drawing line chart with help of WinRT XAML Toolkit. I am setting X axis manually, but when I set I am getting wierd start & end point. I tried to set margin and padding but it's not working. Will you please suggest me how can I do that ?
((LineSeries)MyChart.Series[0]).IndependentAxis = new LinearAxis
{
Minimum = 1,
Maximum = 5,
Orientation = AxisOrientation.X,
Interval = 1,
//Margin = .... Not working
//Padding = .... Not working
};
I'd use a visual tree debugger to walk up the visual tree from these data points to see where the Clip property is set. In fact I just did that on the samples project and it is set on the LineSeries. See if it's set as part of its XAML template or if it is done in C# and remove it there. Also you could change the Minimum/Maximum values on your X axis to make more space. I'll add cleaning this all up to my TODO list.
Specifically, I'm working with an application that only runs on Server 2008 if the "Desktop Experience" feature is installed, and I'd like to have that application's installer verify it's there.
The only way I'm aware of currently is to run ServerManagerCmd -query and parse the output; I'd prefer something more lightweight (like checking a registry key).
This is a code snippet of what I use to do it at runtime.
public static bool isServerFeatureInstalled(Win32_ServerFeature_ID id)
{
bool idFound = false;
ConnectionOptions connectionOptions = new ConnectionOptions();
ManagementScope managementScope =
new ManagementScope(
#"\\localhost\root\cimv2", connectionOptions);
ObjectQuery oQuery =
new ObjectQuery("SELECT Id FROM Win32_ServerFeature");
ManagementObjectSearcher oSearcher =
new ManagementObjectSearcher(managementScope, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
foreach (ManagementObject oReturn in oReturnCollection)
{
if ((uint) (oReturn["ID"]) == (uint) id)
{
return true;
}
}
return idFound;
}
// short list of names and values taken from MSDN.
public enum Win32_ServerFeature_ID
{
Application_Server = 1,
Web_Server = 2,
Media_Server = 3,
Windows_Sharepoint_Services = 4,
Fax_Server = 5,
File_Services = 6,
Print_Services = 7,
Active_Directory_Federation_Services = 8,
Active_Directory_Lightweight_Directory_Services = 9,
Active_Directory_Domain_Services = 10,
UDDI_Services = 11,
DHCP_Server = 12,
DNS_Server = 13,
Network_Policy_and_Access_Services = 14,
Certificate_Server = 16,
Active_Directory_Rights_Management_Services = 17,
Terminal_Services = 18,
Windows_Deployment_Services = 19,
Failover_Clustering = 33,
Network_Load_Balancing = 34,
Desktop_Experience = 35,
DOTNET_Framework_30 = 36,
}
On my testing Windows 2008 x64 std server running this command(adds the role):
ServerManagerCmd.exe -install AS-AppServer-Foundation
adds this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppServer
This command (removes the role):
ServerManagerCmd.exe -remove AS-AppServer-Foundation
removes the key. So I'd think it's a good enough of an indicator.
These are just the results of my own research/experiment and is not an official/supported way of detecting if AppServer role is configured.