|
The way your question is stated makes it look like you are asking for permission. I'm going to guess that you are looking for a free alternative?
A docx-file is a compressed archive (a zip-file) that you can unpack and read.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I would suggest you using Open xml sdk 2.5 along with Power tool. Trust me, it works everytime.
|
|
|
|
|
If you have DOCX installed on your machine, then you can use Word automation (Interop object) to convert DOCX to HTML
referred assembly 'Microsoft Office 8.0 or 14.0 object library' and you can do it easily
see below link
Microsoft Interop API to convert the .doc, .docx, .dot, .dotx and .xls,.xlsx, .rtf to HTML[^]
OR
you can use OpenXmlSDK to convert it to HTML, PowerTools for Open XML has DOCX to HTML facility
check here[^]
Hope it helps
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
Hi all,
I want in my project(in all forms or object of my project) when user Alt+Shift pressed change text of a label.
please help me.
thanks
|
|
|
|
|
Without Hooking you can't do it automatically in all forms - and that's not a nice idea - hooking is complicated and prone to crashing your system if you make a mistake.
Instead, create a form class called "KeyTrapForm" and derive all your project forms from that.
In KeyTrapForm, override ProcessCmdKey:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if ((keyData & Keys.Modifiers) == (Keys.Shift | Keys.Alt))
{
Console.WriteLine("Both pressed");
}
return true;
}
And do your label stuff.
Do be aware that you will get a lot of passes on the if condition as SHIFT and ALT do autorepeat while held down.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
modified 4-Jul-16 5:27am.
|
|
|
|
|
hi to all
i am new with c#
i tray to sum time in grid view footer
i can sum integer but not time
this is my code
int TotalQuantity = 0;
DateTime dt = new DateTime();
TimeSpan ts();
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TotalQuantity += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Quantity"));
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "TotalQuantity";
e.Row.Cells[0].Font.Bold = true;
e.Row.Cells[1].Text = TotalQuantity.ToString();
e.Row.Cells[1].Font.Bold = true;
e.Row.Cells[2].Text = "TotalTime";
e.Row.Cells[2].Font.Bold = true;
e.Row.Cells[3].Text = dt.ToShortTimeString();
e.Row.Cells[3].Font.Bold = true;
}
}
|
|
|
|
|
Where is the code to calculate the total time, and what values are you using as inputs?
|
|
|
|
|
the code is in the body of the message
|
|
|
|
|
I see two lines that are commented out. What happens when you uncomment them, and why are you converting to int in order to add to a double ? What value is returned from Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Time")); ? What do you expect to see from the line e.Row.Cells[3].Text = dt.ToShortTimeString(); ?
|
|
|
|
|
static int Pow(int x, int y=2)
{
int result = 1;
for (int i = 0; i < y; i++)
{
result *= x;
}
return result;
}
static void Main(string[] args)
{
Console.WriteLine(Pow(6));
Console.WriteLine(Pow(3, 4));
}
So, its to pow Method that's confusing me. If someone can brake it down for me in pseudo code this would be a great help. Thanks
|
|
|
|
|
Why not step through the code in the debugger and examine the variable contents after each line of code?
About the only two things that might confuse you are the method header where you have int y = 2 and the result *= x; line.
The method header sets a default value of 2 for y if the caller doesn't provide a 2nd parameter in the method call.
The result line is a shortcut that expands to
result = result * x;
|
|
|
|
|
Not really much that you can break it down to:
static int Pow(int x, int y=2)
{
int result = 1;
for (int i = 0; i < y; i++)
{
result *= x;
}
return result;
}
|
|
|
|
|
Are you aware that the .NET C# Math library includes a 'Pow function: [^]. Note that this function takes Type 'double arguments, and returns a Type 'double result.
Tutorial on Math.Pow here: [^].
Note that my posting this does not mean that I think the OP working this out for themselves is not a good thing
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
This function calculate nth power of a number (where n is the input given by user), if user has not given any input to application, it default collect it as 2 and calculate its 2nd power.
To calculate power system has multiply same number with itself upto nth time and get the desired value
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
I was trying to load a type using only the type FullName and the Assembly name (unqualified, no version number or hash signature)
It seemed to work for some types....
But some .NET dll does not work, for example:
Type.GetType("System.Drawing.Bitmap,System.Drawing")
returns null (even though my app is currently displaying some WinForm Forms).
Any clue ho how to fix that?
I am also hampering myself by trying to write code that will work on Android, .NET Core, UWP....
[EDIT]
AppDomain.Current.GetAssemblies() works on iOS, Android, .NET desktop!
And .NET Core has something similar..
problem solved!
modified 2-Jul-16 8:21am.
|
|
|
|
|
An overloaded version of the same method allows you to throw an exception if there's an error. It would throw a TypeLoadException[^].
On my machine it is complaining that there is no such type in "ConsoleApplication14". Which is not exactly what I expected
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My first thought would be that the current Project does not have a valid reference to System.Drawing, but, I am not familiar with the context (UWP ?) you are working with here.
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Hi Bill,
After some testing I gave up on UWP!
This is for the serializer and UWP stream would have been incompatible with the desktop due to the lack of TypeConverter and ISerializable. Even more vexing I can't find the list of loaded assemblies!
So my serializer target is only desktop .NET, iOS, Android and (coming when VS support .NET Core properly) .NET Core.
As a side note, yes it fails, in a windows forms project...
(it being Type.GetType("System.Drawing.Size,System.Drawing") returns null)
Although, FYI, it succeeed if I use the assembly fullname (with version and evidence) which I don't want to...
So for now I just do the code below now, it works!
public static Type GetType(string typeName, string assemblyName)
{
Type result;
var tass = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.GetName().Name == assemblyName);
if (tass != null)
return tass.GetType(typeName);
return null;
}
BTW, did you get the link I send you!?
There is a live version of the serializer now!
(F5 on test project duplicate a winform)
GitHub - superlloyd/Galador.Reflection[^]
|
|
|
|
|
Hello
I have Excel work book with many Rows, how I can split each bunch of rows to a Sheet, by using some of the speedy stuff you guys have.
Please help or I will lose my job.
|
|
|
|
|
Let me think about that ....
(Dump as CSV, split into multiple files, reload, ...)
|
|
|
|
|
You could do it by writing a short Excel macro, something along the lines of:
Sub Macro1()
Rows("1:12").Select
Selection.Cut
Sheets.Add After:=Sheets(Sheets.Count)
Selection.Insert Shift:=xlDown
End Sub
|
|
|
|
|
By itself, Excel comes with a language Visual Basic , you can write your own programs called macros .
You can even record macros as you use Excel, the recorded macro is a Visual Basic program.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
public class AMCOMDB : DataContext
{
public Table<student> allStudents;
public Table<aClass> allClasses;
public AMCOMDB(string connection) : base(connection) { }
}
[Table(Name = "student")]
public class student
{
private string _studentName;
[Column(IsPrimaryKey =true,Storage ="_studentName")]
public string studentName
{
get
{
return this._studentName;
}
set
{
this._studentName = value;
}
}
private string _LARType;
[Column(Storage ="_LARType")]
public string LARType
{
get
{
return this._LARType;
}
set
{
this._LARType = value;
}
}
private string _studentType;
[Column(Storage = "_studentType")]
public string studentType
{
get
{
return this._studentType;
}
set
{
this._studentType = value;
}
}
private string _aviationLevel;
[Column(Storage = "_aviationLevel")]
public string aviationLevel
{
get
{
return this._aviationLevel;
}
set
{
this._aviationLevel = value;
}
}
private string _airDefenseLevel;
[Column(Storage = "_airDefenseLevel")]
public string airDefenseLevel
{
get
{
return this._airDefenseLevel;
}
set
{
this._airDefenseLevel = value;
}
}
private string _emergencyContact;
[Column(Storage = "_emergencyContact")]
public string emergencyContact
{
get
{
return this._emergencyContact;
}
set
{
this._emergencyContact = value;
}
}
[Table(Name = "grades")]
public class grades
{
private string _studentName;
[Column(IsPrimaryKey = true, Storage = "_studentName")]
public string studentName
{
get
{
return this._studentName;
}
set
{
this._studentName = value;
}
}
private int _ET;
[Column(Storage = "_ET")]
public int ET
{
get
{
return this._ET;
}
set
{
this._ET = value;
}
}
private int _CP;
[Column(Storage = "_CP")]
public int CP
{
get
{
return this._CP;
}
set
{
this._CP = value;
}
}
private int _SB;
[Column(Storage = "_SB")]
public int SB
{
get
{
return this._SB;
}
set
{
this._SB = value;
}
}
private int _EC;
[Column(Storage = "_EC")]
public int EC
{
get
{
return this._EC;
}
set
{
this._EC = value;
}
}
private int _finalGrade;
[Column(Storage = "_finalGrade")]
public int finalGrade
{
get
{
return this._finalGrade;
}
set
{
this._finalGrade = value;
}
}
[Table(Name = "classes")]
public class aClass
{
private string _classNumber;
[Column(IsPrimaryKey = true, Storage = "_classNumber")]
public string classNumber
{
get
{
return this._classNumber;
}
set
{
this._classNumber = value;
}
}
private string _courseSeries;
[Column(Storage = "_courseSeries")]
public string courseSeries
{
get
{
return this._courseSeries;
}
set
{
this._courseSeries = value;
}
}
private string _courseNumber;
[Column(Storage = "_courseNumber")]
public string courseNumber
{
get
{
return this._courseNumber;
}
set
{
this._courseNumber = value;
}
}
private string _distanceLearning;
[Column(Storage = "_distanceLearning")]
public string distanceLearning
{
get
{
return this._distanceLearning;
}
set
{
this._distanceLearning = value;
}
}
private string _classStartDate;
[Column(Storage = "_classStartDate")]
public string classStartDate
{
get
{
return this._classStartDate;
}
set
{
this._classStartDate = value;
}
}
private string _classEndDate;
[Column(Storage = "_classEndDate")]
public string classEndDate
{
get
{
return this._classEndDate;
}
set
{
this._classEndDate = value;
}
}
private string _primaryInstructor;
[Column(Storage = "_primaryInstructor")]
public string primaryInstructor
{
get
{
return this._primaryInstructor;
}
set
{
this._primaryInstructor = value;
}
}
private string _secondaryInstructor;
[Column(Storage = "_secondaryInstructor")]
public string secondaryInstructor
{
get
{
return this._secondaryInstructor;
}
set
{
this._secondaryInstructor = value;
}
}
private string _location;
[Column(Storage = "_location")]
public string location
{
get
{
return this._location;
}
set
{
this._location = value;
}
}
private string _TDYCosts;
[Column(Storage = "_TDYCosts")]
public string TDYCosts
{
get
{
return this._TDYCosts;
}
set
{
this._TDYCosts = value;
}
}
private string _studentCount;
[Column(Storage = "_studentCount")]
public string studentCount
{
get
{
return this._studentCount;
}
set
{
this._studentCount = value;
}
}
private List<grades> _classGrades;
[Column(Storage = "_classGrades")]
public List<grades> classGrades
{
get
{
return this._classGrades;
}
set
{
this._classGrades = value;
}
}
As you can see I have 3 classes under 1 database file. The problem I am having is that when I try to pull data using:
AMCOMDB ADB = new AMCOMDB(connectionString);
if (ADB.DatabaseExists())
{
var stud = ADB.GetTable<student>();
var clas = ADB.GetTable<aClass>();
IQueryable<string> query = from c in stud
where c.studentName.Length > 5
orderby c.studentName.Length
select c.studentName.ToUpper();
foreach (string name in query)
{
}
}
I get this at the foreach statement:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: Invalid object name 'student'.
I have tried to change everything and I even tried to create 3 database files but the error still comes up. I don't know what I am doing wrong. Any help is appreciated.
modified 1-Jul-16 15:28pm.
|
|
|
|
|
The results of the query can be "null"; you need to check your "query" variable for null (and also pick a more descriptive / less confusing variable name).
|
|
|
|
|
Hi, I'm using a property as byte array in a model. Now while serializing this model into xml, if this property is null, then it's not rendering as tag. I'm using [XmlElement(IsNullable=true)] attribute on that property.If i do this, in this case it's creating tag with attribute something like xi:nil=true. I don't want this. If that property is null, then make it as empty element else assign value.
Please give me solution.
|
|
|
|