how set postion and size image Variables Stimulsoft Core - core

hi iam use stimulsofr ver mvc core.
i want get image Variables and set setting properties for image .
this my code;
public ActionResult GetReportSnapshot(string sort)
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Reports/Jobs.mrt"));
report["#PrjectId"] = 1;
report["#OrderBy"] = sort;
// this problem
report.Dictionary.Variables["image"].width=5
report.Render();
}

hi iam sloved this problem:
StiReport report = new StiReport();
var image = report.GetComponentByName("Image1") as StiImage;
image.CanGrow =false ;

Related

Display XPS Document in WPF

I need to display data from a database into a WPF app and save it as an XPS document. I want to display it as part of a main window (with Toolbar, Menu and StatusBar) and not as a new window.
What control(s) should I use? Currently, I am looking at FixedDocument and FlowDocument. Am I on the right track? Any good material on how to start?
Improving on Stehpen's answer above...
Assume you've added a documents folder to your project:
Create a method GetDocument where the GetFilePath method refers to the Folder/Filename in the folder above.
private void GetDocument()
{
string fileName = Environment.CurrentDirectory.GetFilePath("Documents\\Title.xps");
Debugger.Break();
XpsDocument doc = new XpsDocument(fileName, FileAccess.Read);
XDocViewer.Document = doc.GetFixedDocumentSequence();
}
Where GetFilePath is an extension method that looks like this:
public static class StringExtensions
{
public static string GetFilePath(
this string EnvironmentCurrentDirectory, string FolderAndFileName)
{
//Split on path characters
var CurrentDirectory =
EnvironmentCurrentDirectory
.Split("\\".ToArray())
.ToList();
//Get rid of bin/debug (last two folders)
var CurrentDirectoryNoBinDebugFolder =
CurrentDirectory
.Take(CurrentDirectory.Count() - 2)
.ToList();
//Convert list above to array for Join
var JoinableStringArray =
CurrentDirectoryNoBinDebugFolder.ToArray();
//Join and add folder filename passed in
var RejoinedString =
string.Join("\\", JoinableStringArray) + "\\";
var final = RejoinedString + FolderAndFileName;
return final;
}
}
Add a Document viewer in your XAML
And add this code in the cs file:
string fileName = null;
string appPath= System.IO.Path.GetDirectoryName(Assembly.GetAssembly(typeof(DocumentWindow)).CodeBase);
fileName = appPath + #"\Documents\Help.xps";
fileName = fileName.Remove(0, 6);
XpsDocument doc = new XpsDocument(fileName, FileAccess.Read);
docView.Document = doc.GetFixedDocumentSequence();

Inconsistent Result With Bing Map Silverlight Using Basic Key

Hi I have used following code but sometime I didnt get the pushpin, I am using Basic key can any one please suggest me.
public MainPage()
{
InitializeComponent();
Geocode("8800 Lyra Avenue, Columbus, OH 43240", 1);
Geocode("2137 Birchwood Dr, Redmond,WA 78214,U.S.", 1);
Geocode("Santa Cruz, Duval Co., TX", 1);
}
private void Geocode(string address, int waypointIndex)
{
PlatformServices.GeocodeServiceClient geocodingService = new PlatformServices.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
geocodingService.GeocodeCompleted += new EventHandler<TestSL.PlatformServices.GeocodeCompletedEventArgs>(geocodingService_GeocodeCompleted);
PlatformServices.GeocodeRequest request = new PlatformServices.GeocodeRequest();
request.Credentials = new TestSL.PlatformServices.Credentials();
request.Credentials.ApplicationId = ((Microsoft.Maps.MapControl.ClientTokenCredentialsProvider)(MyMap.CredentialsProvider)).Token;
request.Query = address;
geocodingService.GeocodeAsync(request, waypointIndex);
}
public void geocodingService_GeocodeCompleted(object sender, TestSL.PlatformServices.GeocodeCompletedEventArgs e)
{
MapLayer myMapLayer = new MapLayer();
MyMap.Children.Add(myMapLayer);
// create a location collection class
LocationCollection myLocationColl = new LocationCollection();
var geoResult = (from r in e.Result.Results
orderby (int)r.Confidence ascending
select r).FirstOrDefault();
if (geoResult != null)
{
Pushpin myPushPin = new Pushpin();
// set it to first found location
myPushPin.Location = new Microsoft.Maps.MapControl.Location(geoResult.Locations[0].Latitude, geoResult.Locations[0].Longitude);
ToolTipService.SetToolTip(myPushPin, geoResult.DisplayName);
// add it to location collection
// which would be used to set the map's bound
myLocationColl.Add(myPushPin.Location);
// Add the drawn point to the route layer.
myMapLayer.Children.Add(myPushPin);
}
}
Sometime i get two pushpin and Sometime I didnt get anything and sometimes i get 1 or 3. can any one please tell me why this is happening.
You should geocode all your data ahead of time and store the coordinates. Trying to geocode a bunch of addresses on the fly like this will drive up the number of transactions generated by your application. When using a basic key it can be rate limited if a bunch of requests are made in a short period of time. When the request is rate limited a flag is added to the header of the response to indicate this. This is documented at the bottom half of this page: http://msdn.microsoft.com/en-us/library/ff701703.aspx

How can I set a value for TextBox.FontFamily property?

I am trying to learn WPF, the problem is I need to learn XAML first. In System.Windows.Controls.TextBox class, there is property 'FontFamily'. I will have to set a font for it. In one of my book I saw But where can I get this font(Verdana). Where is list of all font's in MSDN Library?
Ikbal Hassan
You can bind to the string name of the font as shown below as font.Name. The following code is loading up a ComboBox of all the fonts.
var installedfonts = new InstalledFontCollection();
int idFont = 0;
foreach ( var font in installedfonts.Families )
{
var fonttype = new LookupSelectItem { Id = idFont, Name = font.Name };
FontTypeList.Add( fonttype );
++ idFont;
}

Silverlight 4 chart created at runtime won't show data

Using the Silverlight 4 toolkit chart control, I am trying to create a chart 100% at runtime with no evidence of it anywhere in the XAML. To do so, I create the blank chart when the page loads:
Chart TrendChart = new Chart();
TrendChart.Name = "TrendChart";
TrendChart.Title = "Call History";
TrendChart.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
TrendChart.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
TrendChart.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
TrendChart.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;
GridPanel.Children.Add(TrendChart);
After the user clicks on a button to retrieve data, a List is created of this custom class:
private class PhoneTrendDataPoint
{
public string XValue { get; set; }
public double YValue { get; set; }
}
I use that List, called CurrentCallTrends, as an ItemsSource for my chart.
// Update the chart with the received data
Chart TrendChart = (Chart)this.FindName("TrendChart");
// Wipe out previous chart data
TrendChart.Series.Clear();
// set the data
ColumnSeries columnSeries = new ColumnSeries();
columnSeries.Name = "Current Call Volume";
columnSeries.ItemsSource = CurrentCallTrends;
//columnSeries.SetBinding(ColumnSeries.ItemsSourceProperty, new Binding("CurrentCallTrends"));
columnSeries.DependentValueBinding = new Binding("XValue");
columnSeries.IndependentValueBinding = new Binding("YValue");
TrendChart.Series.Add(columnSeries);
The problem is that I get a runtime error where it prompts me to open a debugger regarding an object reference not set to an instance of an object. If I comment the line to .SetBinding then the ItemsSource vanishes and no data shows up, but at least there is no runtime error.
What am I missing?
After additional Googling, I made some modifications that seem to work but don't strike me as the best way to go about doing this. Data now shows up, but I will not accept this as the answer unless there is no better method:
// Update the chart with the received data
Chart TrendChart = (Chart)this.FindName("TrendChart");
// Wipe out previous chart data
TrendChart.Series.Clear();
// test data
KeyValuePair<string, double>[] CurrentCallData = new KeyValuePair<string, double>[CurrentCallTrends.Count];
for (int i = 0; i < CurrentCallTrends.Count; i++)
{
CurrentCallData[i] = new KeyValuePair<string, double>(CurrentCallTrends[i].XValue, CurrentCallTrends[i].YValue);
}
// set the data
ColumnSeries columnSeries = new ColumnSeries();
columnSeries.Name = "CurrentCallVolume";
columnSeries.Title = "Current Call Volume";
columnSeries.SetBinding(ColumnSeries.ItemsSourceProperty, new Binding());
//columnSeries.ItemsSource = CurrentCallTrends;
columnSeries.ItemsSource = CurrentCallData;
columnSeries.DependentValueBinding = new Binding("Value");
columnSeries.IndependentValueBinding = new Binding("Key");
TrendChart.Series.Add(columnSeries);
//this.DataContext = CurrentCallTrends;

How can I track the after save event in word ? there is no existing DocumentAfterSave Event ?? Silverlight app

This is my sample source code :
dynamic dlg = objWord.Dialog(objWord.Dialog.WdWordDialog.wdDialogFileSaveAs);
Nullable<bool> result = dlg.ShowDialog();
//Process save file dialog box results
if (result == true)
{
// Save document
string filename = dlg.SafeFileName;
MessageBox.Show(filename);
}
Do i need to use the Microsoft.Office.Interop.dll? It's not running on my workstation, I used silverlight 5 beta..
Thank You :)

Resources