|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string GetNextFreeRelationshipID()
|
|
|
private string GetNextFreeRelationshipID()
|
|
|
{
|
|
|
{
|
|
|
string id =
|
|
|
|
|
|
(
|
|
|
|
|
|
from r in mainPart.GetRelationships()
|
|
|
|
|
|
select r.Id
|
|
|
|
|
|
).Max();
|
|
|
|
|
|
|
|
|
|
|
|
// The convension for ids is rid01, rid02, etc
|
|
|
|
|
|
string newId = id.Replace("rId", "");
|
|
|
|
|
|
|
|
|
int id = (
|
|
|
|
|
|
from r in mainPart.GetRelationships()
|
|
|
|
|
|
where r.Id.Substring(0, 3).Equals("rId")
|
|
|
|
|
|
select int.Parse(r.Id.Substring(3))
|
|
|
|
|
|
).DefaultIfEmpty().Max();
|
|
|
|
|
|
|
|
|
|
|
|
// The conventiom for ids is rid01, rid02, etc
|
|
|
|
|
|
string newId = id.ToString();
|
|
|
int result;
|
|
|
int result;
|
|
|
if (int.TryParse(newId, out result))
|
|
|
if (int.TryParse(newId, out result))
|
|
|
return ("rId" + (result + 1));
|
|
|
return ("rId" + (result + 1));
|